Skip to content

Instantly share code, notes, and snippets.

@dekokun
Created December 25, 2011 15:02
Show Gist options
  • Save dekokun/1519388 to your computer and use it in GitHub Desktop.
Save dekokun/1519388 to your computer and use it in GitHub Desktop.
愚直なエラトステネスの篩(本来の手書きでエラトステネスの篩を行った時のような視覚効果を狙った。)
ns = Array.new(99){|i| i+2}
result = Array.new(99){|i| i+2}
ns.each do |i|
result.map!{|h| h != '.' && h != i && h % i == 0 ? '.' : h }
p result
end
@dekokun
Copy link
Author

dekokun commented Dec 25, 2011

直した。

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