aUCBLogo Demos and Tests / primes_graph
to primes_graph [size 1000000] [flags IntArray size]
t=timefine
imax=1+int sqrt size
for [i 2 imax 1]
[ if flags.i==0
[ for [k i+i size i] ~
[ flags.k=1
]
]
]
pr timefine-t
nr=size-flags
primecount=FloatArray nr
j=0
for [i 1 size]
[ if flags.i==0
[ j=j+1
primecount.j=i
]
]
clearScreen
WindowMode
setPenSize 0
PenUp
setXY -400 -300
PenDown
setXY (rSeqFA 0 nr nr)/nr*800-400 primecount/size*600-300
updateGraph
zoomscene
end