# 1996 AHSME Problems/Problem 12

## Problem 12

A function $f$ from the integers to the integers is defined as follows: $$f(n) =\begin{cases}n+3 &\text{if n is odd}\\ \ n/2 &\text{if n is even}\end{cases}$$

Suppose $k$ is odd and $f(f(f(k))) = 27$. What is the sum of the digits of $k$? $\textbf{(A)}\ 3\qquad\textbf{(B)}\ 6\qquad\textbf{(C)}\ 9\qquad\textbf{(D)}\ 12\qquad\textbf{(E)}\ 15$

## Solution

### First iteration

To get $f(k) = 27$, you could either have $f(27 - 3)$ and add $3$, or $f(27\cdot 2)$ and divide by $2$.

If you had the former, you would have $f(24)$, and the function's rule would have you divide. Thus, $k=54$ is the only number for which $f(k) = 27$.

### Second iteration

Going out one step, if you have $f(f(k)) = 27$, you would have to have $f(k) = 54$. For $f(k) = 54$, you would either have $f(54-3)$ and add $3$, or $f(54\cdot 2)$ and divide by $2$.

Both are possible: $f(51)$ and $f(108)$ return values of $54$. Thus, $f(f(51)) = f(54) = 27$, and $f(f(108)) = f(54) = 27$.

### Third iteration

Going out the final step, if you have $f(f(f(k))) = 27$, you would have to have $f(f(k))) = 51$ or $f(f(k)) = 108$.

If you doubled either of these, $k$ would not be odd. So you must subtract $3$.

If you subtract $3$ from $51$, you would compute $f(48)$, which would halve it, and not add the $3$ back.

If you subtract $3$ from $108$, you would compute $f(105)$, which would add the $3$ back.

Thus, $f(f(f(105))) = f(f(108)) = f(54) = 27$, and $105$ is odd. The desired sum of the digits is $6$, and the answer is $\boxed{B}$.

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