zondag 6 maart 2011

Euler problem 36

The decimal number, 585 = 10010010012 (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.)


performance improvements:
1) Generate Palindromes to reduce loop from 1000000 to 1110 times.


Problem36 =      872187 elapsed time:    3 ms. Test Passed.

Geen opmerkingen:

Een reactie posten