Created
June 4, 2014 03:21
-
-
Save Goles/5897f3af0d5256ee489d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let N = 1000; | |
var i = 2; | |
var array = Bool[](count:N, repeatedValue:true); | |
for i in 2..array.count { | |
for var j = 2; j * i < array.count; ++j { | |
if array[j * i] { | |
array[j * i] = false | |
} | |
} | |
} | |
for i in 2..array.count { | |
if array[i] { | |
println(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It doesn't work anymore. It's very outdated.