Hi all,
found this interesting, .. somewhat special, it has lazy and / or (land / lor )
not too slow , in the attached example the calculation of the primes (the famous sieve :: # upto 125000) takes less than a sec (newLISP 0.5 and Steel Bank CL 0.02sec) -- but I forgot "step 2" in the sieve loop (no primes are even > 2) .. so even faster.
Pseudo 3D , the height stands for x²+y² where x+iy is the Gaussprime.
------------------- source -------------------------
dim primes(2*260*250)
dim i , j
dim pts = 1
dim x# , y# ,prime# , angle#
for i=1 to 2*250*250
primes(i)=i
next
for i=3 to 250*250
if (primes(i)>0) then
j=2
while i*j < 2*250*250
primes(i*j)=0
j=j+1
wend
end if
next
printr "ok"
glnewlist(pts,GL_COMPILE)
glBegin (GL_POINTS)
for x#=-200 to 200
for y#=-200 to 200
prime#= x#*x#+y#*y#
glColor3f (0,1,0)
if primes(prime#)>0 then
glVertex3f (x#/50,y#/50,-prime#/15000)
end if
next
next
glEnd()
glendlist()
while true
glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
glloadidentity()
glTranslatef (0, 0,-6)
glRotatef (angle#, 1, 1, 0)
glcalllist(pts)
swapbuffers()
while SyncTimer (10)
angle# = angle# + 0.2
wend
wend
---------------------------------------------------
makes standalones , runs perfectly under Wine too.
best Rob
.