Count Palindromic Base Representations
Problem statement
For each integer base from 2 through 16, convert the positive integer value to that base. Return how many of those digit sequences read the same from left to right and right to left. Digits are compared by numeric value, so bases above ten need no special text encoding.
Function
countPalindromicBases(value: int) → intExamples
Example 1
value = 9return = 9The binary and base-eight forms are palindromes, and every base above nine uses one digit.
Example 2
value = 5return = 13Each base is checked independently using its digit sequence.
Constraints
1 <= value <= 1000000000bases 2 through 16 are inclusive