Sieve of Eratosthenes

Davide Varvello d.varvello at
Wed Oct 11 11:35:25 UTC 2006

Hi All,
  Moreover, there was a mistake in my code, the right one is this:

runOn: aNumber
  	| 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 mailing list