Math day 5:

**Fibonacci Sequence**

**Fibonacci Sequence and Music**

In western music theory, we know an octave including 13 notes:

C, C#, D, D#, E, F, F#, G, G#, A, A#,B, C (1,1#,2,2#,3,4,4#,5,5#,6,6#,7,i)

**Is there anything special about numbers** **13?**

We notice an octive including** 5 sharps** notes (C#,D#,F#,G#, A#), and **8 regular notes** (C,D,E,F,G,A,B,C).

Now if we go one more step further look at the key distribution on a piano:

The 5 sharp notes are in groups of 2 and 3.

Now, if we re-think about the numbers, we have **2+3=5, 5+8=13.**

so we have a sequence of number: 2,3,5,8,13, which is a segment of Fibonacci sequences.

Fibonacci Sequence:

1,1,2,3,5,8,13,21,34….

**Fibonacci Sequence Definition:**

F(1)=1，F(2)=1, F(n)=F(n-1)+F(n-2)

Personally, I think it is very interesting how the Fibonacci Sequence emerged in Music Theory.

**Where is the Fibonacci Sequence come from?**

this was a story my previous student told me, there were 2 bunnies on an island, then they started a family, the family members formed Fibonacci sequence ….

Now, given a random positive nature number, can we tell it is a Fibonacci Number very quick?

Personally, I could not tell if the number is >100. but, our friend Python can!

**A little Fibonacci number Yes or No Python game:**

import math def isPerfectSquare(x): i=int(math.sqrt(x)) return (x==i*i) def isFibnoacci(n): if (isPerfectSquare(5*n*n+4) or isPerfectSquare(5*n*n-4)): print (n, "is a Fibonacci Number") else: print(n,"is not a Fibonacci Number" )

**Now we can run our Game Test:**

isFibnoacci(4) 4 is not a Fibonacci Number isFibnoacci(168) 168 is not a Fibonacci Number isFibnoacci(1000) 1000 is not a Fibonacci Number isFibnoacci(89) 89 is a Fibonacci Number

**Note: The Keypoint is every Fibonacci number is in the form of 5n²+4 or 5n²-4.**

**Bonus:**

The Fibonacci number is so fascinating in music, art and science not only because of its practical use but also it leads to the Golden Ratio!