2018 AMC 10B Problems/Problem 20

Revision as of 15:16, 16 February 2018 by Walnutwaldo20 (talk | contribs)

Problem

A function $f$ is defined recursively by $f(1)=f(2)=1$ and \[f(n)=f(n-1)-f(n-2)+n\]for all integers $n \geq 3$. What is $f(2018)$?

$\textbf{(A)} \text{ 2016} \qquad \textbf{(B)} \text{ 2017} \qquad \textbf{(C)} \text{ 2018} \qquad \textbf{(D)} \text{ 2019} \qquad \textbf{(E)} \text{ 2020}$

Solution

$f\left(n\right) = f\left(n - 1\right) - f\left(n - 2\right) + n$

$= \left(f\left(n - 2\right) - f\left(n - 3\right) + n - 1\right) - f\left(n - 2\right) + n$

$= 2n - 1 - f\left(n - 3\right)$

$= 2n - 1 - \left(2\left(n - 3\right) - 1 - f\left(n - 6\right)\right)$

$= f\left(n - 6\right) + 6$

Thus, $f\left(2018\right) = 2016 + f\left(2\right) = 2017$. $\boxed{B}$