# Palindromic numbers

I was reading an article about palindromes the other day, and came across a formel definition of palindromic numbers.

Although palindromic numbers are most often considered in the decimal system, the concept of palindromicity can be applied to the natural numbers in any numeral system.

For the few who does not know it already, here it is – and it gave me an excuse to write a little more $\LaTeX$ 🙂

Consider a number $n>0$ in base $b\le 2$, where it is written in standard notation with $k+1$ digits $a_i$ as:

$\displaystyle{n = \sum_{i=0}^k a_i b^i}$

with, as usual, $0\le a_i < b$ for all $i$ and $a_k \ne 0$. Then $n$ is palindromic if and only if $a_i = a_{k-i}$ for all $i$. Zero is written $0$ in any base and is also palindromic by definition.