Sieve of Eratosthenes
d.varvello at quinary.com
Wed Oct 11 11:35:25 UTC 2006
Moreover, there was a mistake in my code, the right one is this:
| sieve |
sieve := Array new: aNumber withAll: true.
sieve at: 1 put: false.
2 to: aNumber do: [:i | (sieve at: i) ifTrue: [2*i to: aNumber by:
i do: [:k | sieve at: k put: false] ]
More information about the Squeak-dev