On 626
March 11th, 2006
I earlier today I noticed That I had passed 625 unique page-views, a rater significant number in base-25 (which the counter at the bottom of the page is - The actual number of hits it has counted is closer to 2300).
One of the additional things I noticed about this number is that it is a palindrome in both bases - 626 in base 10, 101 in base 25. Just wondering how many of there are, I found a chanse to use ruby. Of course, Ruby has it covered. In an amazingly code-free manner.
So, based off that code, I came up with some more - all the dual palindromes from one to one million:
(1..1000000).find_all{|n|n.to_s == n.to_s.reverse && n.to_s(25) == n.to_s(25).reverse}.collect.each { |x| puts x.to_s + "\t\t" + x.to_s(25); }
It comes up with this list:
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 11 b 22 m 494 jj 626 101 676 121 1001 1f1 6886 b0b 7887 cfc 8338 d8d 9339 ene 622226 1eke1 626626 1f2f1
-Sud.
Posted in Ruby |