Problem 550: (2007 AMC 12b, 21)
The first $2007$ positive integers are each written in base $3$. How many of these base-$3$ representations are palindromes? (A palindrome is a number that reads the same forward and backward.)
$\textbf {(A)} 100\qquad \textbf {(B)} 101\qquad \textbf {(C)} 102\qquad \textbf {(D)} 103\qquad \textbf {(E)} 104$
- Since $2007=2202100_3$, we count base-$3$ palindromes with at most $7$ digits that are at most $2202100_3$.
- A palindrome with $\ell$ digits has a nonzero first digit ($2$ choices) and $\lceil \ell/2\rceil-1$ further free digits. For $\ell=1,\dots,6$ this gives $2,2,6,6,18,18$, totaling $52$.
- There are $2\cdot3^3=54$ seven-digit palindromes. Those exceeding $2202100_3$ have the form $22x\,y\,x22$ with $x\ge1$: $2\cdot3=6$ of them (with $x=0$, $220y022<2202100$).
- Total: $52+54-6=100$.
- The answer is (A).
The first $100$ positive integers are each written in base $2$. How many of these base-$2$ representations are palindromes?