Palindromic primes in base 16: Difference between revisions
Content deleted Content added
Thundergnat (talk | contribs) m syntax highlighting fixup automation |
→{{header|Ruby}}: Add Ruby |
||
Line 603: | Line 603: | ||
Found 13 palindromic primes in base 16 |
Found 13 palindromic primes in base 16 |
||
done... |
done... |
||
</pre> |
|||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby">res = Prime.each(500).filter_map do |pr| |
|||
str = pr.to_s(16) |
|||
str if str == str.reverse |
|||
end |
|||
puts res.join(", ")</syntaxhighlight> |
|||
{{out}} |
|||
<pre>2, 3, 5, 7, b, d, 11, 101, 151, 161, 191, 1b1, 1c1 |
|||
</pre> |
</pre> |
||