Created
May 9, 2014 22:30
-
-
Save river24/9204f176cda4a250daf9 to your computer and use it in GitHub Desktop.
510から531までの素数を調べる
This file contains 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' | |
range = 510..531 | |
range.each do |num| | |
if Prime.instance.prime?(num) | |
print "#{num} is a prime : " | |
else | |
print "#{num} is not a prime : " | |
end | |
factors = num.prime_division | |
p factors | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment