AMC 10 Step by Step

2018 AMC 10B Problem 20

P16-20~5 minPrint

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≥3n \geq 3 . What is f(2018)f(2018) ?

Log in to save your progress.
Show solution without answering

Key insight

Work out the first dozen values. Every 6 steps the value goes up by exactly 6, so jump from f(2) to f(2018) in steps of 6.

Solution

The rule is easy to use, so compute values and look for a pattern.

  1. A table. Each value is the previous one, minus the one before that, plus nn.
nn112233445566778899101011111212
f(n)f(n)111133668888777799121214141414

For example, f(3)=1−1+3=3f(3) = 1 - 1 + 3 = 3 and f(4)=3−1+4=6f(4) = 3 - 1 + 4 = 6.
2. Spot the pattern. Compare each value with the one 66 places earlier: f(7)=7=1+6f(7) = 7 = 1 + 6, f(8)=7=1+6f(8) = 7 = 1 + 6, f(9)=9=3+6f(9) = 9 = 3 + 6, f(10)=12=6+6f(10) = 12 = 6 + 6, and so on. Each value is 66 more than the value 66 steps back:
f(n)=f(n−6)+6.f(n) = f(n-6) + 6.
3. Why it keeps going. Write the rule for nn and for n−1n-1:
f(n)=f(n−1)−f(n−2)+n,f(n−1)=f(n−2)−f(n−3)+(n−1).f(n) = f(n-1) - f(n-2) + n,\qquad f(n-1) = f(n-2) - f(n-3) + (n-1).
Put the second into the first. The f(n−2)f(n-2) terms cancel, leaving
f(n)=−f(n−3)+2n−1.f(n) = -f(n-3) + 2n - 1.
Use this again with n−3n-3 in place of nn: f(n−3)=−f(n−6)+2n−7f(n-3) = -f(n-6) + 2n - 7. Substituting,
f(n)=f(n−6)−2n+7+2n−1=f(n−6)+6.f(n) = f(n-6) - 2n + 7 + 2n - 1 = f(n-6) + 6.
4. Jump to 2018. 2018=2+6×3362018 = 2 + 6 \times 336, so from f(2)f(2) we take 336336 jumps of 66 steps, each adding 66:
f(2018)=f(2)+6×336=1+2016=2017.f(2018) = f(2) + 6 \times 336 = 1 + 2016 = 2017.

The answer is (B) 2017\boxed{\textbf{(B)}\ 2017}.

Why this works

When a rule is simple to apply, a table of the first several values often shows a repeating pattern. Here the pattern repeats every 66 steps with a steady climb of 66. Once you have a "jump" rule like that, reach a far-away value by counting jumps from a small value with the same remainder.

Alternative approach

Look at the gap f(n)−nf(n) - n in the table: 0,−1,0,2,3,20, -1, 0, 2, 3, 2, then again 0,−1,0,2,3,20, -1, 0, 2, 3, 2. It repeats every 66. Since 20182018 leaves remainder 22 when divided by 66, it matches n=2n = 2, where the gap is −1-1. So f(2018)=2018−1=2017f(2018) = 2018 - 1 = 2017.

Concise solution

A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.

Write the recursion for nn and for n−1n - 1:
f(n)=f(n−1)−f(n−2)+n,f(n−1)=f(n−2)−f(n−3)+(n−1).f(n) = f(n-1) - f(n-2) + n, \qquad f(n-1) = f(n-2) - f(n-3) + (n-1).
Adding them cancels f(n−1)f(n-1) and f(n−2)f(n-2):
f(n)=−f(n−3)+2n−1.f(n) = -f(n-3) + 2n - 1.
Apply this twice: f(n−3)=−f(n−6)+2(n−3)−1=−f(n−6)+2n−7f(n-3) = -f(n-6) + 2(n-3) - 1 = -f(n-6) + 2n - 7, so
f(n)=f(n−6)−2n+7+2n−1=f(n−6)+6.f(n) = f(n-6) - 2n + 7 + 2n - 1 = f(n-6) + 6.

So stepping the index by 66 raises ff by exactly 66. Since 2018=2+6⋅3362018 = 2 + 6 \cdot 336,
f(2018)=f(2)+6⋅336=1+2016=2017.f(2018) = f(2) + 6 \cdot 336 = 1 + 2016 = 2017.

The answer is (B) 2017\boxed{\textbf{(B)}\ 2017}.

Review in the AoPS books

Similar problems

Problem © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. Solution and commentary are original to this site.