Given that \(f(1) = f(2) = 1\) and \(f(n) = f(n-1) - f(n-2) + n\) for all integers \(n \geq 3\) and we need to find the value of f(2018)In these type of problems its always advised to find a pattern and then try to conclude the answer based on the pattern you identify.Let's start by finding f(3)
To find f(3) we need to compare what is inside the bracket in f(3) and f(n)
=> We need to substitute n with 3 in f(n) = f(n-1) - f(n-2) + n to get the value of f(3)
=> f(3) = f(3-1) - f(3-2) + 3 = f(2) - f(1) + 3 = 1-1 + 3 = 3
Similarly, f(4) = f(4-1) - f(4-2) + 4 = f(3) - f(2) + 4 = 3-1 + 4 = 2 + 4 = 6
f(5) = f(4) - f(3) + 5 = 6 - 3 + 5 = 3 + 5 = 8
f(6) = f(5) - f(4) + 6 = 8 - 6 + 6 = 2 + 6 = 8
f(7) = f(6) - f(5) + 7 = 8 - 8 + 7 = 7
f(8) = f(7) - f(6) + 8 = 7 - 8 + 8 = 7
f(9) = f(8) - f(7) + 9 = 7 - 7 + 9 = 9
f(10) = f(9) - f(8) + 10 = 9 - 7 + 10 = 12
f(11) = f(10) - f(9) + 11 = 12 - 9 + 11 = 14
f(12) = f(11) - f(10) + 12 = 14 - 12 + 12 = 14
f(13) = f(12) - f(11) + 13 = 14 - 14 + 13 = 13
f(14) = f(13) - f(12) + 14 = 13 - 14 + 14 = 13
f(15) = f(14) - f(13) + 15 = 13 - 13 + 15 = 15
f(16) = f(15) - f(14) + 16 = 15 - 13 + 16 = 18
f(1) = 1
f(2) = 1
f(3) = 3f(4) = 6
f(5) = 8
f(6) = 8
f(7) = 7
f(8) = 7 = 8-1
f(9) = 9f(10) = 12
f(11) = 14
f(12) = 14
f(13) = 13
f(14) = 13 = 14-1
f(15) = 15f(16) = 18
Leaving the first two value of f(1) and f(2) we notice that
Every Odd Multiple of 3 has the same value as the number inside the function and we can calculate the values before after using the pattern given above
Ex: f(3) = 3, f(9)=9 and f(15) = 15
Now, 2018 = 2019-1 and 2019= 3*673 => odd multiple of 3
=> f(2019) = 2019
=> f(2018) = 2018-1 = 2017 ( as f(8) = 8-1 and f(14) = 14-1
So,
Answer will be BHope it helps!
Watch the following video to learn the Basics of Functions and Custom Characters