-
-
Save sanemat/4714203 to your computer and use it in GitHub Desktop.
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
def prime?(number) | |
return false if number == 1 | |
2.upto(number) do |key| | |
return false if number != key && number.to_f % key == 0 | |
end | |
true | |
end | |
primes = [*1...100].select{|n| prime? n} | |
data = [] | |
primes.each do |m| | |
primes.each do |n| | |
next if m * n > 100 | |
data << m * n | |
end | |
end | |
data.sort.uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment