Last active
December 21, 2015 22:19
-
-
Save sumikawa/6374091 to your computer and use it in GitHub Desktop.
Show prime day in 2013
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
#!/usr/bin/env ruby | |
require 'prime' | |
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | |
(201301..201312).each do |m| | |
sd = (m.to_s + "01").to_i | |
ed = (m.to_s + days[m % 12].to_s).to_i | |
(sd..ed).each do |n| | |
puts n if Prime.prime?(n) | |
end | |
end |
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
20130203 | |
20130223 | |
20130403 | |
20130413 | |
20130503 | |
20130521 | |
20130527 | |
20130529 | |
20130707 | |
20130829 | |
20130931 | |
20131019 | |
20131103 | |
20131109 | |
20131117 | |
20131129 | |
20131207 | |
20131211 | |
20131217 | |
20131229 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment