% Apfelm"annchen
% (C) 1995 by M. Thole
%
\documentstyle[11pt,german]{article}
\pagestyle{empty}

% Punkt setzen
% Aufruf \punkt x,y
\def\punkt#1,#2{%
\put(#1,#2){\rule{1mm}{1mm}}%
}
%
\def \tp#1 {\typeout{#1}}
%

\begin{document}

\begin{center}
Dies ist nun ein Apfelm"annchen in \TeX\ bzw.\ in \LaTeX\ !
\end{center}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcount \groesse \groesse=100

\newcount \pmin \pmin=-2250
\newcount \pmax \pmax=750
\newcount \qmin \qmin=-1500
\newcount \qmax \qmax=1500

\newcount \kmax \kmax=16             
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\unitlength1mm
\begin{center}
\begin{picture}(\groesse,\groesse)
%\linethickness{2pt}
\newcount \p
\newcount \q
\newcount \x
\newcount \y
\newcount \k
\newcount \xneu
\newcount \yneu
\newcount \xquad
\newcount \yquad
\newcount \betrag
\newcount \grber \global\grber=\groesse \global\advance\grber by-1
\newcount \deltap \global\deltap=\pmax \global\advance\deltap by-\pmin
\newcount \deltaq \global\deltaq=\qmax \global\advance\deltaq by-\qmin
\newcount \j 
\newcount \i 
%\newcount \dum             % Dummy

\tp{-------- Los geht's--------}
\global\j=0%
\loop {\global\i=0 \tp{\number\j} % loop 1
\global\p=\deltap \global\multiply\p by\j \global\divide\p by\grber \global\advance\p by\pmin%
\loop { % loop 2
\global\q=\deltaq \global\multiply\q by\i \global\divide\q by\grber \global\advance\q by\qmin%
\global\x=0 \global\y=0 \global\k=0 \global\xquad=\x \global\multiply\xquad by \x \global\yquad=\y % 
\global\multiply\yquad by\y%
\loop { %loop3
\global\xneu=\xquad \global\advance\xneu by-\yquad \global\divide\xneu by 1000 \global\advance\xneu by\p%
\global\yneu=\x \global\multiply\yneu by\y \global\divide\yneu by500 \global\advance\yneu by \q%
\global\advance\k by1 \global\x=\xneu \global\y=\yneu %
\global\xquad=\x \global\multiply\xquad by \x \global\yquad=\y \global\multiply\yquad by\y%
\ifnum\k<\kmax {\global\betrag=\xquad \global\advance\betrag by \yquad} \else {\global\betrag=16000000} \fi 
      }% end 3
\ifnum\betrag<16000000 \repeat %
\ifodd\k { \punkt\j,\i } \fi %
 }% end 2
\ifnum\i<\groesse \global\advance\i by1 \repeat}% end 1
\ifnum\j<\groesse \global\advance\j by1 \repeat%
\tp{------ fertig --------}

\end{picture}
\end{center}
\end{document}

