# 1987 AHSME Problems/Problem 29

## Problem

Consider the sequence of numbers defined recursively by $t_1=1$ and for $n>1$ by $t_n=1+t_{(n/2)}$ when $n$ is even and by $t_n=\frac{1}{t_{(n-1)}}$ when $n$ is odd. Given that $t_n=\frac{19}{87}$, the sum of the digits of $n$ is $\textbf{(A)}\ 15 \qquad \textbf{(B)}\ 17 \qquad \textbf{(C)}\ 19 \qquad \textbf{(D)}\ 21 \qquad \textbf{(E)}\ 23$

## Solution

If $n$ is even, then $t_{(n/2)}$ would be negative, which is not possible. Therefore, $n$ is odd. With this function, backwards thinking is the key. If $t_x < 1$, then $x$ is odd, and $t_{(x-1)} = \frac{1}{t_{x}}$. Otherwise, you keep on subtracting 1 and halving x until $t_\frac{x}{2^{n}} < 1$. We can use this logic to go backwards until we reach $t_1 = 1$, like so: $t_n=\frac{19}{87}\\\\t_{n-1} = \frac{87}{19}\\\\t_{\frac{n-1}{2}} = \frac{68}{19}\\\\t_{\frac{n-1}{4}} = \frac{49}{19}\\\\t_{\frac{n-1}{8}} = \frac{30}{19}\\\\t_{\frac{n-1}{16}} = \frac{11}{19}\\\\t_{\frac{n-1}{16} - 1} = \frac{19}{11}\\\\t_{\frac{\frac{n-1}{16} - 1}{2}} = \frac{8}{11}\\\\t_{\frac{\frac{n-1}{16} - 1}{2} - 1} = \frac{11}{8}\\\\t_{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2}} = \frac{3}{8}\\\\t_{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1} = \frac{8}{3}\\\\t_{\frac{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1}{2}} = \frac{5}{3}\\\\t_{\frac{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1}{4}} = \frac{2}{3}\\\\t_{\frac{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1}{4} - 1} = \frac{3}{2}\\\\t_{\frac{\frac{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1}{4} - 1}{2}} = \frac{1}{2}\\\\t_{\frac{\frac{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1}{4} - 1}{2} - 1} = 2\\\\t_{\frac{\frac{\frac{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1}{4} - 1}{2} - 1}{2}} = t_1 = 1 \Rightarrow \frac{\frac{\frac{\frac{\frac{\frac{n-1}{16} - 1}{2} - 1}{2} - 1}{4} - 1}{2} - 1}{2} = 1 \Rightarrow n = 1905$, so the answer is $\boxed{\textbf{(A)} 15}$.

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. 