Mod Fibonacci

Finite Melodies for an Infinite Sequence

A few years ago I asked myself how I could play the Fibonacci sequence on the piano. I found that if I divided the Fibonacci sequence by the number of keys I wished to play, I got a set of numbers that would infinitely repeat. I tested this observation with Python and found that no matter how many keys I chose, there was a finite melody.
At the time, my family joked with me that I had found something new. I explained that someone had done it before, I just had to figure out who. With some searching I found the Pisano periods noted in 1774 by Joseph-Louis Lagrange.
I wonder how many times people in history have rediscovered the wonders of mathematical patterns in their basements or at their piano(me).
I published the half-step versions of the sequence and have them as a PDF here.
I have been teaching myself p5.js and coded a version to play with this week. This is a draft of the code. I have not gotten it to work in CodePen yet and it seems to only play in edit mode on p5.js. I am hoping to expand and create a web app for this. Note: “Full Step” is not full step – it’s just sans sharps.
Member discussion