Finding a rule for palindromes

1.6k Views Asked by At

I was just thinking, Is there some mathematical rule that is a formula for all the palindromes? And if there is a rule what is it?

1

There are 1 best solutions below

2
On BEST ANSWER

The palindromes of length $1$ are $0, 1, \dots, 9$.

Let $n$ be a positive even integer; let $n = 2m$. Every palindrome of length $n$ is of the form $$\sum_{k=0}^{m-1}p_k(10^{(n-1)-k} + 10^k)$$ where $p_0, p_1, \dots, p_{m-1} \in \{0, 1, \dots, 9\}$, $p_0 \neq 0$.

Let $n$ be a positive odd integer, $n \geq 3$; let $n = 2m+1$. Every palindrome of length $n$ is of the form $$\sum_{k=0}^{m-1}p_k(10^{(n-1)-k} + 10^k) + p_m10^m$$ where $p_0, p_1, \dots, p_m \in \{0, 1, \dots, 9\}$, $p_0 \neq 0$.