Here’s a much simpler way to arrive at the same number as ferrouslepidoptera:
- There are a1 = 12 melodies of length 1, where each melody is a single note of length 1.
- There are a2n = 12 + an2 melodies of length 2n, where each melody is either a single note of length 2n, or the concatenation of two melodies of length n.
- Therefore, there are a32 = 12 + (12 + (12 + (12 + (12 + 122)2)2)2)2
= 123,511,210,975,209,861,511,554,928,715,787,036
melodies of length 32.