### Sieve of Eratosthenes

Posted:

**Jan Tue 20, 2009 10:57 pm**Here is my Woz BASIC Implementation of a prime number finder using the Sieve of Eratosthenes. You can crank up N a bit, but eventually you'll get MEM FULL ERR.

Next up I'm working on a multiplication program that uses the Rhind papyrus method.

- Derrik

- Code: Select all
`100 PRINT "*** SIEVE OF ERATOSTHENES ***"`

120 N=100

130 DIM S(N)

140 LET P=2

150 FOR I = 1 TO N

160 S(I) = I

170 NEXT I

180 PRINT P

190 FOR J = P TO N STEP P

200 LET S(J) = 0

210 NEXT J

220 LET P = P + 1

230 IF P = N THEN GOTO 500

240 IF S(P) <> 0 THEN GOTO 180

250 GOTO 220

500 END

Next up I'm working on a multiplication program that uses the Rhind papyrus method.

- Derrik