Find palindromic numbers in both binary and ternary bases: Difference between revisions
Find palindromic numbers in both binary and ternary bases (view source)
Revision as of 23:50, 28 March 2014
, 10 years ago→{{header|Ruby}}
m (→{{header|Ruby}}: spaces) |
|||
Line 261:
=={{header|Ruby}}==
This program is based on the observation that the double palindromic numbers in base 3 all have a "1" right in the middle. Also, both base 2 and base 3 representations have an odd number of digits. (NB I have no mathematical proof of this).
This program constructs
The first six took less then one second, 381920985378904469 took around 40 minutes (using one core) and 146 million possible candidates.
<lang ruby>
|