Post Reply 
Ulam spiral
12-25-2013, 07:09 PM
Post: #2
RE: Ulam spiral
Posted by Gilles Carpentier on 22 July 2013, 5:38 p.m.

Code:

EXPORT Ulam
BEGIN
 LOCAL a,b,xy:={160,120}, n:=1, m:=.9, d:={{1,0}, {0,1}, {-1,0}, {0,-1}};
 RECT();
 WHILE n<100000 DO
  FOR a FROM 1 TO 4 DO
   m:=m+.5;
   FOR b FROM 1 TO m DO
    IF isprime(n) THEN PIXON_P(xy,127);END;
    xy:=xy+d(a);
    n:=n+1;
   END;
  END;
 END;
 FREEZE;
END;

another one !

Regards,

Damien.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Ulam spiral - Tugdual - 12-22-2013, 09:15 PM
RE: Ulam spiral - Damien - 12-25-2013 07:09 PM
RE: Ulam spiral - logoliv - 08-28-2020, 11:09 AM
RE: Ulam spiral - Joe Horn - 08-28-2020, 01:14 PM
RE: Ulam spiral - logoliv - 08-28-2020, 02:33 PM



User(s) browsing this thread: 5 Guest(s)