Suppose you want to know how many palindromes are in the set of integers from 1 to N. Can you provide a formula for this? Otherwise, can you give an algorithm, as efficient as possible, to find the answer? And, are there special values of N for which there is a simple formula?
If you allow leading zeroes, then if N=2K, you got 10^K-1 possibilities (excluding 000....000); if N=2K-1, the answer is also 10^K-1.
To show why, if N=6, you got 001100, 002200, ..., to 998899, and 999999. For N=5, you got 00100, 00200, ... 99899, and 99999.