Created
December 1, 2015 14:59
-
-
Save ytkhs/25df7918c578ecb67bcf to your computer and use it in GitHub Desktop.
8桁表示で素数日や連続素数日を探す ref: http://qiita.com/qube81/items/e681c4abd28eebe9bbad
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
require 'prime' | |
require 'date' | |
puts [*Date.new(2015, 1, 1).upto(Date.new(2015, 12, 31))].flat_map{|d| | |
Prime.prime?(d.strftime('%Y%m%d').to_i) ? [d.to_s] : [] | |
} |
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
2015-01-11 | |
2015-01-31 | |
2015-02-27 | |
2015-03-03 | |
2015-03-27 | |
2015-04-11 | |
2015-05-13 | |
2015-08-21 | |
2015-10-11 | |
2015-10-31 | |
2015-11-27 | |
2015-12-21 | |
2015-12-27 |
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
require 'prime' | |
require 'date' | |
[*Date.new(2015, 1, 1).upto(Date.new(2020, 12, 31))].flat_map{|d| | |
Prime.prime?(d.strftime('%Y%m%d').to_i) ? [d] : [] | |
}.each_cons(2) {|d1, d2| | |
puts d1, d2, "\n" if (d2-d1).to_i == 2 | |
} |
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
2016-04-01 | |
2016-04-03 | |
2016-10-19 | |
2016-10-21 | |
2017-03-01 | |
2017-03-03 | |
2017-09-01 | |
2017-09-03 | |
2019-02-27 | |
2019-03-01 | |
2020-01-09 | |
2020-01-11 | |
2020-01-21 | |
2020-01-23 | |
2020-07-21 | |
2020-07-23 |
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
require 'prime' | |
require 'date' | |
[*Date.new(2015, 1, 1).upto(Date.new(2100, 12, 31))].flat_map{|d| | |
Prime.prime?(d.strftime('%Y%m%d').to_i) ? [d] : [] | |
}.each_cons(3) {|d1, d2, d3| | |
if (d2-d1).to_i == 2 && (d3-d2).to_i == 2 | |
puts d1, d2, d3, "\n" | |
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
2085-06-29 | |
2085-07-01 | |
2085-07-03 | |
2087-04-29 | |
2087-05-01 | |
2087-05-03 |
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
require 'prime' | |
require 'date' | |
[*Date.new(2015, 1, 1).upto(Date.new(2020, 12, 31))].flat_map{|d| | |
Prime.prime?(d.strftime('%Y%m%d').to_i) ? [d] : [] | |
}.each_cons(2) {|d1, d2| | |
puts d1, d2, "\n" if (d2-d1).to_i == 1 | |
} |
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
2017-08-31 | |
2017-09-01 | |
2018-07-31 | |
2018-08-01 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment