The decimal number 585 = 1001001001 in binary is palindromic in both bases. Given n, find the sum of all numbers below n that are palindromic in both base 10 and base 2. (Single-digit numbers are palindromic.)
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 10^6
Tags: