Skip to main content

2018 AMC 10B Problem 20

Problem 20 of 25HarderAlgebraProblem-Solving Techniques

A function ff is defined recursively by f(1)=f(2)=1f(1) = f(2) = 1 and f(n)=f(n−1)−f(n−2)+nf(n) = f(n - 1) - f(n - 2) + n for all integers n≥3.n \ge 3. What is f(2018)?f(2018)?

Answer choices

Show solution

Solution

Notice f(n)=n+1f(n) = n + 1 solves the recurrence on its own, so write f(n)=(n+1)+g(n).f(n) = (n + 1) + g(n). Then gg satisfies the homogeneous version g(n)=g(n−1)−g(n−2).g(n) = g(n-1) - g(n-2). With g(1)=−1g(1) = -1 and g(2)=−2,g(2) = -2, it cycles with period 66: −1,−2,−1,1,2,1,….-1, -2, -1, 1, 2, 1, \ldots. Since 2018≡2(mod6),2018 \equiv 2 \pmod 6, we get g(2018)=−2,g(2018) = -2, so f(2018)=2019−2=2017.f(2018) = 2019 - 2 = 2017. Therefore, the answer is B.
AoPS wiki

Tagged: recursion · pattern recognition

More practice