Joe lost a bet to Bob. He had to pay a huge amount of candy! Here's how he went about it:
On the first day of school, Joe gave 1 piece of candy to Bob. On the second day, Joe gave 1 piece of candy to Bob. On the third day, Joe gave 2 pieces of candy to Bob. On the fourth day, Joe gave 3 pieces of candy to Bob. On the fifth day, Joe gave 5 pieces of candy to Bob.
In general, on the day he gave pieces of candy, where is the Fibonacci number. Joe pays like this until the 180th day of school.
In total he payed pieces of candy to Bob. Find
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.
Take the first few Fibonacci numbers.
1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987...
Now take the following mod 3
1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0
We see it repeats - (1,1,2,0,2,2,1,0)(1,1,2,0,2,2,1,0)- In cycles of 8.
Since Joe does this process till the 180th day: in every cycle of eight he pays 9 (mod 3) pieces of candy. 180/8= 22 R 4.
Because mods are distributive over addition, in the 22 cycles of 9 pieces of candy he pays, that is 0 (mod 3) because 9=0(mod 3) and that is the sum of the pieces of candy's he pays in every cycle of 8.
In the four remaining he pays from the first four in the cycle- 1+1+2=4
4=1(mod 3) And we're done.
Note: I have no idea why this recursion occurs. Could someone explain that?