Skip to content

Instantly share code, notes, and snippets.

@Goles
Created June 4, 2014 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Goles/5897f3af0d5256ee489d to your computer and use it in GitHub Desktop.
Save Goles/5897f3af0d5256ee489d to your computer and use it in GitHub Desktop.
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);
}
}
@RahulBhalley
Copy link

It doesn't work anymore. It's very outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment