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)$ ?

2019
2018
2016
2017
2020

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

$f(1) = 1\ \\ \color{#20A900} f(2) = 1 \\ f(3) = 3 \\ f(4) = 6 \\ f(5) = 8 \\ f(6) = 8 \\ f(7) = 7\ \\ \color{#20A900}f(8) = 7 \\ f(9) = 9 \\ f(10) =12 \\ f(11) = 14 \\ f(12) = 14 \\ f(13) = 13\ \\ \color{#20A900}f(14) = 13$

Note that $f(6k + 2) = (6k + 2) - 1$ (as in $\color{#20A900}green$ ) and

$2018 = 6 \cdot\ k + 2$ (where $k$ is equal to $336$ )

So, $f(2018) = 2018 - 1 = 2017$