Olympiad Maths Prep

Track / Stage 3 / 136 of 260 #136 of 2000

Problem 136

AMC 10/12, early questions
Number theory Difficulty 3.6 Find the answer

Define a function on the positive integers recursively by f(1)=2f(1) = 2, f(n)=f(n1)+1f(n) = f(n-1) + 1 if nn is even, and f(n)=f(n2)+2f(n) = f(n-2) + 2 if nn is odd and greater than 11. What is f(2017)f(2017)?
(A) 2017(B) 2018(C) 4034(D) 4035(E) 4036\textbf{(A)}\ 2017 \qquad\textbf{(B)}\ 2018 \qquad\textbf{(C)}\ 4034 \qquad\textbf{(D)}\ 4035 \qquad\textbf{(E)}\ 4036

Official solutions — 2

Solution 1

This is a recursive function, which means the function refers back to itself to calculate subsequent terms. To solve this, we must identify the base case, f(1)=2f(1)=2. We also know that when nn is odd, f(n)=f(n2)+2f(n)=f(n-2)+2. Thus we know that f(2017)=f(2015)+2f(2017)=f(2015)+2. Thus we know that n will always be odd in the recursion of f(2017)f(2017), and we add 22 each recursive cycle, which there are 10081008 of. Thus the answer is 10082+2=20181008*2+2=2018, which is answer
(B)\boxed{\textbf{(B)}}.
Note that when you write out a few numbers, you find that f(n)=n+1f(n)=n+1 for any nn, so f(2017)=2018f(2017)=2018

Solution 2

1. Define the function f f on the positive integers recursively:
f(1)=2 f(1) = 2
f(n)=f(n1)+1if n is even f(n) = f(n-1) + 1 \quad \text{if } n \text{ is even}
f(n)=f(n2)+2if n is odd and greater than 1 f(n) = f(n-2) + 2 \quad \text{if } n \text{ is odd and greater than 1}

2. Define a new function g(n)=f(n)n g(n) = f(n) - n . We start with:
g(1)=f(1)1=21=1 g(1) = f(1) - 1 = 2 - 1 = 1

3. Analyze the behavior of g(n) g(n) for even n n :
f(n)=f(n1)+1    g(n)=f(n)n=(f(n1)+1)n=f(n1)(n1)=g(n1) f(n) = f(n-1) + 1 \implies g(n) = f(n) - n = (f(n-1) + 1) - n = f(n-1) - (n-1) = g(n-1)
Therefore, g(n)=g(n1) g(n) = g(n-1) when n n is even.

4. Analyze the behavior of g(n) g(n) for odd n n :
f(n)=f(n2)+2    g(n)=f(n)n=(f(n2)+2)n=f(n2)(n2)=g(n2) f(n) = f(n-2) + 2 \implies g(n) = f(n) - n = (f(n-2) + 2) - n = f(n-2) - (n-2) = g(n-2)
Therefore, g(n)=g(n2) g(n) = g(n-2) when n n is odd.

5. From the above steps, we see that g(n) g(n) is constant for all n n . Since g(1)=1 g(1) = 1 , we have:
g(n)=1for all n g(n) = 1 \quad \text{for all } n

6. Therefore, for any n n :
f(n)=g(n)+n=1+n f(n) = g(n) + n = 1 + n

7. Specifically, for n=2017 n = 2017 :
f(2017)=1+2017=2018 f(2017) = 1 + 2017 = 2018

The final answer is 2018\boxed{2018}

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.