base if it reads the same forwards and backwards both in decimal and when written in base base (both forms without leading zeros).
For example, 5 is a twin palindrome for base 2, since in binary it is 101. But 6 is not: in binary it is 110.
Return the sum of the count smallest twin palindromes for base base.base=2, count=4 → 16
The first such numbers are 1 (1), 3 (11), 5 (101) and 7 (111), with the binary form in brackets. Their sum is 16.
base=4, count=5 → 66
The numbers are 1, 2, 3, 5 (11 in base 4) and 55 (313 in base 4); 4 = 10₄ and 6 = 12₄ do not qualify. The sum is 66.
base=9, count=30 → 18627530
base=2, count=4
16
Run checks the first 3 tests in your browser. Submit checks all 60 tests on the server, hidden ones included.