2023 SSMO Accuracy Round Problems/Problem 2

Problem

Suppose that the average of all $n$-digit palindromes is denoted by $P_{n}$ and the average of all $n$-digit numbers is denoted by $N_{n}.$ Find $\left\lfloor\sum_{n=1}^{100}(P_{n}-N_{n})\right\rfloor.$

Solution

The outermost digits of an $n$-digit palindrome can range from $1$ to $9$, each with equal probability (notice that they must be equal due to being a palindrome, so the ones digit cannot be $0$), so the average is $5$. The inner digits can range from $0$ to $9$, again with equal probability, so their average is $4.5$. Thus $P_n=5(10^{n-1}+1)+4.5(10+10^2+\ldots+10^{n-2})$.

However, the $n$-digit numbers range in the exact same way except that the ones digit can range from $0$ to $9$. Thus $N_n=5(10^{n-1})+4.5(1+10+10^2+\ldots+10^{n-2})$.

Then, PnNn=5(10n1+1)+4.5(10+102++10n2)5(10n1)4.5(1+10+102++10n2)=5(1)4.5(1)=0.5

However, we must consider one special case: $n=1$. Here, $0$ is an $n$-digit number, so the difference between $P_1$ and $N_1$ is $0$ (they are the same set). For all $n>1$ the difference is $0.5$; therefore, \[\left\lfloor\sum_{n=1}^{100}(P_{n}-N_{n})\right\rfloor=\lfloor0+99\cdot0.5\rfloor=\lfloor49.5\rfloor=\boxed{49}\]

~ eevee9406