Gandalf has a sequence of numbers. The first number and the second number . You can calculate the rest of the sequence using the given formula . What is ?
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.
Note that the answer should be 0 . See the solution below.
Given that a 0 = a 1 = 1 1 and a n = a n − 1 − a n − 2 for n ≥ 2 , therefore,
a 2 a 3 a 4 a 5 a 6 a 7 = a 1 − a 0 = 1 − 1 = 0 = a 2 − a 1 = 0 − 1 = − 1 = a 3 − a 2 = − 1 − 0 = − 1 = a 4 − a 3 = − 1 + 1 = 0 = a 5 − a 4 = 0 + 1 = 1 = a 6 − a 5 = 1 − 0 = 1
We note that a 6 = a 7 = a 0 = a 1 = 1 , the sequence repeats with a period of 6. That is a n + 6 = a n . Therefore.
a n = ⎩ ⎪ ⎨ ⎪ ⎧ 1 0 − 1 if n m o d 6 = 0 or 1 if n m o d 6 = 2 or 5 if n m o d 6 = 3 or 4
Since the first number is a 0 , the 1248th number is a 1 2 4 7 = 0 , because 1 2 4 7 m o d 6 = 5 .