The decimal number,
(binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic
in base 10 and base 2.
(Please note that the palindromic number, in either base, may not include
leading zeros.)
The hardest part of this problem, for me, was generating a list of palindrome numbers. I made it a little harder for myself by insisting they be ordered but I got it done. After the "trivial" palindromic numbers (0 - 99) there's a relationship between the generating number of the p-number and it's relative position with the highest number with one fewer digits. Once I had my array of p-numbers it was easy to convert them to binary strings, compare that to its "mirror," and save the corresponding decimal value. Finally, I added up all of those values. 87,159