Ormiston triples: Difference between revisions
→{{header|Ruby}}: anagram, not palindrome.
(→{{header|Ruby}}: anagram, not palindrome.) |
|||
Line 2,122:
require 'prime'
def
sorted = arr.first.digits.sort
arr[1..].all?{|a| a.digits.sort == sorted}
end
res = Prime.each.each_cons(3).lazy.filter_map{|ar| ar.first if
res.each_slice(5){|slice| puts slice.join(", ")}
n = 1E9
res = Prime.each(n).each_cons(3).count {|ar|
puts "\nThere are #{res} Ormiston triples below #{n}"
</syntaxhighlight>
|