In an 88 key grand piano, is the number of possible, distinct melodies bigger than the number of atoms in the universe? Assume there are atoms in the universe.
Details:
Melodies can have from 2 to 88 notes.
Each key in the piano is a different note.
Melodies cannot have repeated notes.
Melodies are sequences of notes, one played after the other.
Bonus
What is the minimum number of keys needed to have more melodies than atoms? And if repeated notes were allowed, how would this number compare to ?
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.
Since the melodies do not contain repeated notes, each melody of n notes will be of the form ( n 8 8 ) = n ! ( 8 8 − n ) ! 8 8 ! . Since melodies are sequences of notes, the order in which they are played matters, so we need to multiply the ( n 8 8 ) by n ! to count all possible permutations of melodies of n notes.
Now, to count all possible, distinct melodies, we need to add up every melody of n length with n being a positive integer from 2 to 88 inclusive:
n = 2 ∑ 8 8 ( 8 8 − n ) ! 8 8 !
We can rewrite this sum to reveal an astonishing fact:
n = 2 ∑ 8 8 ( 8 8 − n ) ! 8 8 ! = 8 8 ! n = 2 ∑ 8 8 ( 8 8 − n ) ! 1 = 8 8 ! n = 0 ∑ 8 6 n ! 1
We get the taylor series of e x when x = 1 up to the 87th term! The value of the green expression can be approximated to e so the number of possible, distinct melodies in an 88 key grand piano is roughly:
n = 2 ∑ 8 8 ( 8 8 − n ) ! 8 8 ! ≈ 8 8 ! ⋅ e
Finally, we need to compare this to the number of atoms in the universe. First we take the ln:
ln ( 1 0 8 6 ) = 8 6 ln ( 1 0 ) = 8 6 ( ln ( 5 ) + ln ( 2 ) ) ln ( 8 8 ! ⋅ e ) = ln ( 8 8 ! ) + ln ( e ) = ln ( 8 8 ! ) + 1
We know that ln ( a ! ) = j = 1 ∑ a ln j . We can set upper and lower bounds for the value of this sum as follows:
∫ 1 a ln ( x + 1 ) d x > j = 1 ∑ a ln j ≥ ∫ 1 a ln ( x ) d x , for a ≥ 1
We evaluate the integrals:
( a + 1 ) ln ( a + 1 ) − a > j = 1 ∑ a ln j ≥ a ln a − a + 1
In our case a = 8 8 :
( 8 8 + 1 ) ln ( 8 8 + 1 ) − 8 8 − ( ( 1 + 1 ) ln ( 1 + 1 ) − 1 ) > j = 1 ∑ 8 8 ln j > 8 8 ln ( 8 8 ) − 8 8 + 1 − ( 1 ln ( 1 ) − 1 + 1 ) 8 9 ln ( 8 9 ) − 2 ln ( 2 ) − 8 9 + 1 + 2 − 1 > ln ( 8 8 ! ) > 8 8 ( ln ( 1 1 ) + 3 ln ( 2 ) ) − 8 8 + 1 8 9 ( ln ( 8 9 ) − 1 ) − 2 ( ln ( 2 ) − 1 ) > ln ( 8 8 ! ) > 8 8 ( ln ( 1 1 ) + 3 ln ( 2 ) − 1 ) + 1
We observe that 8 8 ( ln ( 1 1 ) + 3 ln ( 2 ) − 1 ) + 2 > 8 6 ( ln ( 5 ) + ln ( 2 ) ) . Therefore, the number of possible, distinct melodies in an 88 key grand piano is bigger than the number of atoms in the universe.
Bonus
To find the minimum number of keys needed for this to happen we need to find the smallest a such that ln ( a ! ) + 1 > 8 6 ln ( 1 0 ) . For this we evaluate the lower bound of the sum j = 1 ∑ a ln j :
a ln ( a ) − a + 2 ≥ 8 6 ln ( 1 0 ) a ln ( a ) − a + 2 = 8 6 ln ( 1 0 ) ⟹ a ≈ 6 2 . 5
So the minimum number of keys needed would be 63.
Now, if repeated notes are allowed, the total number of distinct possible melodies would be given by the following finite geometric series:
S = n = 2 ∑ 8 8 8 8 n = 8 8 n = 1 ∑ 8 7 8 8 n S = 8 8 ⋅ 8 8 − 1 8 8 ( 8 8 8 7 − 1 )
We take the log of S:
lo g ( S ) = 2 lo g ( 8 8 ) + lo g ( 8 8 8 7 − 1 ) − lo g ( 8 8 − 1 ) lo g ( 8 8 8 7 − 1 ) ≈ lo g ( 8 8 8 7 ) ⟹ lo g ( S ) ≈ 2 lo g ( 8 8 ) + lo g ( 8 8 8 7 ) − lo g ( 8 7 ) lo g ( S ) ≈ 8 9 lo g ( 8 8 ) − lo g ( 8 7 ) ≈ 1 7 1 S ≈ 1 0 1 7 1
This means that this sum is 1 0 8 5 times bigger than the number of atoms in the universe. It is almost the number of atoms in the universe squared.