HMMT-Feb 2023 alg, Problem 9

For any positive integers $a$ and $b$ with $b>1$, let $s_{b}(a)$ be the sum of the digits of $a$ when it is written in base $b$. Suppose $n$ is a positive integer such that \[ \sum_{i=1}^{\left\lfloor\log _{23} n\right\rfloor} s_{20}\left(\left\lfloor\frac{n}{23^{i}}\right\rfloor\right)=103 \quad \text { and } \quad \sum_{i=1}^{\left\lfloor\log _{20} n\right\rfloor} s_{23}\left(\left\lfloor\frac{n}{20^{i}}\right\rfloor\right)=115 \] Compute $s_{20}(n)-s_{23}(n)$.

Solution: Solution: First we will prove that \[ s_{a}(n)=n-(a-1)\left(\sum_{i=1}^{\infty}\left\lfloor\frac{n}{a^{i}}\right\rfloor\right) \] If $n=\left(n_{k} n_{k-1} \cdots n_{1} n_{0}\right)_{a}$, then the digit $n_{i}$ contributes $n_{i}$ to the left side of the sum, while it contributes \[ n_{i}\left(a^{i}-(a-1)\left(a^{i-1}+a^{i-2}+\cdots+a^{1}+a^{0}\right)\right)=n_{i} \] to the right side, so the two are equal as claimed. Now we have \[ \begin{aligned} 103 & =\sum_{i=1}^{\infty} s_{20}\left(\left\lfloor\frac{n}{\left.23^{i}\right\rfloor}\right.\right. \\ & =\sum_{i=1}^{\infty}\left(\left\lfloor\frac{n}{23^{i}}\right\rfloor-19\left(\sum_{j=1}^{\infty}\left\lfloor\frac{\left\lfloor n / 23^{i}\right\rfloor}{20^{j}}\right\rfloor\right)\right) \\ & =\sum_{i=1}^{\infty}\left\lfloor\frac{n}{23^{i}}\right\rfloor-19 \sum_{i=1}^{\infty} \sum_{j=1}^{\infty}\left\lfloor\frac{n}{20^{j} \cdot 23^{i}}\right\rfloor \end{aligned} \] where we have used the fact that $\left\lfloor\frac{\lfloor n / p\rfloor}{q}\right\rfloor=\left\lfloor\frac{n}{p q}\right\rfloor$ for positive integers $n, p, q$. Similarly, \[ 115=\sum_{j=1}^{\infty}\left\lfloor\frac{n}{20^{j}}\right\rfloor-22 \sum_{i=1}^{\infty} \sum_{j=1}^{\infty}\left\lfloor\frac{n}{20^{j} \cdot 23^{i}}\right\rfloor \] Let \[ A=\sum_{j=1}^{\infty}\left\lfloor\frac{n}{20^{j}}\right\rfloor, \quad B=\sum_{i=1}^{\infty}\left\lfloor\frac{n}{23^{i}}\right\rfloor, \quad \text { and } \quad X=\sum_{i=1}^{\infty} \sum_{j=1}^{\infty}\left\lfloor\frac{n}{20^{j} \cdot 23^{i}}\right\rfloor \] Then we have $103=B-19 X$ and $115=A-22 X$. Thus, we have \[ \begin{aligned} s_{20}(n)-s_{23}(n) & =\left(n-19 \sum_{j=1}^{\infty}\left\lfloor\frac{n}{20^{j}}\right\rfloor\right)-\left(n-22 \sum_{i=1}^{\infty}\left\lfloor\frac{n}{23^{i}}\right\rfloor\right) \\ & =22 B-19 A \\ & =22(103+19 X)-19(115+22 X) \\ & =22 \cdot 103-19 \cdot 115=81 \end{aligned} \] Remark. The value $n=22399976$ satisfies both equations, so a valid solution to the system exists. It seems infeasible to compute this solution by hand. $\fbox{81}$.

Answer: 81