This is the recursive definition of a sequence:
f(1)=3
f(n)=f(n−1)+3 ... for n>1
The problem asks for the value of f(5). Note that 5 is a small value, so the value of f(5) may be found by finding f(2) thru f(5). However, recursion usually means starting with f(5) [a recursive case] and elaborating until f(1) is used [the base case]. Let's do that (note: this is one of the main uses of a STACK data structure).
With recursion, it is important to use the recursive case and the base case !!
f(5) = f(4) + 3
f(5) = ( f(3) + 3 ) + 3
f(5) = ( ( f(2) + 3 ) + 3 ) + 3
f(5) = ( ( ( f(1) + 3 ) + 3 ) + 3 ) + 3
f(5) = ( ( ( 3 + 3 ) + 3 ) + 3 ) + 3
f(5) = ( ( 6 + 3 ) + 3 ) + 3
f(5) = ( 9 + 3 ) + 3
f(5) = 12 + 3
f(5) = 15
David W.
In this recursive definition, f(1)=3 is given as the base case. You should never use f(0).12/21/22