Problem Statement
The decimal representation of $414$ is 414, which is a palindrome. Also, the octal representation of $414$ is 636, which is also a palindrome. Based on this, solve the following problem.
You are given positive integers $A$ and $N$. Find the sum of all integers between $1$ and $N$, inclusive, whose decimal representation and base-$A$ representation are both palindromes.
Under the constraints of this problem, it can be proved that the answer is less than $2^{63}$.
Constraints
- $2 \leq A \leq 9$
- $1 \leq N \le 10^{12}$
- All input values are integers.
Solving
ęäø¾åčæå¶åęę°ēååéØåļ¼åå„ę°åå¶ę°ēåęęé ļ¼
å„ę°åäøŗēē„ęå导ę°ååę„äøåę°åå转åēę°ļ¼å¶ę°åē“ę„ę„äøå转åēę°åļ¼äøčæ°ęä½ä½æēØå符串ęä½å®ęļ¼éåå¾å°ēę°čæč”å¤ęęÆå¦ę»”č¶³ačæå¶äøåęå³åÆ
|
|