Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the fall term of 201-5, Nick^2 took COMP 2S04. Nick was always sitting in the

ID: 3792308 • Letter: I

Question

In the fall term of 201-5, Nick^2 took COMP 2S04. Nick was always sitting in the back of the classroom and spent most of his time eating bananas. Nick uses the following banana-buying-scheme: At the start of week 0; there are 2 bananas in Nick's fridge. For any integer n > 0, Nick does the following during week n: At the start of week n. Nick determines the number of bananas in his fridge and stores this number in a variable x. Nick goes to Jim's Banana Empire, buys x bananas, and puts them in his fridge. Nick takes n + 1 bananas out of his fridge and cats them during week n. For any integer n greaterthanorequalto 0, let B(n) be the number of bananas in Nick's fridge at the start of week n. Determine the value of B(n).

Explanation / Answer

Look the number of bananas at the start of the week n is twice the number of bananas at the start of the week n-1 minus n(they are eaten)

B(0)=2 (given)

B(n)=2*B(n-1)-(n) (recursive)

B(n)=n+2 for n>=0 (direct) , if you calculate for B(0),B(1),B(2),B(3) you will see the pattern.