IFLB

Mathematics & music · May 20, 2024

How many 9-note scales are there?

It looks like a simple problem of enumerating scales in the 12 pitch-class tempered system. But the road runs through partitions, cyclic compositions and Burnside's lemma.

Mathematics & music/May 20, 2024/17 min read

This is a simple problem of enumerating the scales that exist in the 12 pitch-class tempered system. But it may not be so simple to work out…

When I first asked myself the question, my first move was to try to solve it on the chromatic circle. There can't be that many, I thought. And so I set about drawing the points on a clock with 12 tick marks.

Chromatic circle with 12 tick marks representing 1 pitch and 1 semitone
Chromatic circle with 12 tick marks representing 1 pitch and 1 semitone

But I found it isn't that simple, that I was missing a system. So I turned to the mathematics.

It turns out that solving this problem means thinking in terms of partitions.

The idea is basically this: a scale is a succession of intervals. In equal temperament we can think of every interval as a sum of semitones, regardless of whether they are diatonic or chromatic. Between two pitches there is a distance counted in semitones, and the minimum distance is 1 semitone.

From C to D there are 2 semitones; from E to G there are 3 semitones. If we take the octave as the boundary within which the scale is defined, we have 12 semitones in total. So, adding up all the distances between 2 consecutive pitches of the scale, we get the value 12 semitones.

Let us think of each distance as a term in a sum whose total has to be 12. And I have to distribute those 12 semitones among the 9 distances that separate the consecutive pitches of the scale (counting the one that closes the octave). The approach is to distribute semitones among the distances, not to fix each distance separately.

When I need to solve something very specific, I usually start from the most generic case. That is the approach taken here, through a series of questions.

1. How many sums adding up to 12 can be made?

In a set of 12 semitones, we can create subsets by grouping them so that no semitone belongs to 2 subsets. The size (in semitones) of each subset is a distance between two consecutive pitches. This is what partitioning a set means.

The 12 elements of our set of semitones. Each one is worth 1
The 12 elements of our set of semitones. Each one is worth 1

The subscript may be confusing, but it is there to tell each element of the set apart. We can group them like this:

Three ways of partitioning a set of 12 semitones
Three ways of partitioning a set of 12 semitones

In the case of partitions, neither the number of terms nor their order matters.

Let us look briefly at what a partition is. A partition of an integer nn is a way of writing nn as a sum of positive integers, regardless of order. Note that:

  • The terms are positive integers (no zeros or negatives allowed).
  • Order does not matter, that is, 4+3+2+34+3+2+3 is the same partition as 3+3+4+23+3+4+2.
  • Terms may repeat, for example, 5+5+25+5+2 is a partition of 12.

All of this can be found in more detail on Wikipedia: Partition.

Let us look at an example. The partitions of 44 are:

  1. 44
  2. 3+13+1
  3. 2+22+2
  4. 2+1+12+1+1
  5. 1+1+1+11+1+1+1

In total, there are 5 partitions of 4.

The values of p(n)p(n) for n=0,1,2,3,4n = 0, 1, 2, 3, 4 \ldots are:

1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 1,\ 1,\ 2,\ 3,\ 5,\ 7,\ 11,\ 15,\ 22,\ 30,\ 42,\ 56,\ 77,\ \ldots

This is what is called a sequence, and it can be found in the OEIS: A000041. There is even a recurrence, derived from Euler's pentagonal number theorem, for computing the number of partitions of a given number:

Euler's recurrence for p(n)p(n)

p(n)=k=1(1)k1(p(nk(3k1)/2)+p(nk(3k+1)/2))p(n) = \sum_{k=1}^{\infty} (-1)^{k-1} \left( p(n - k(3k-1)/2) + p(n - k(3k+1)/2) \right)

with the conventions p(0)=1p(0) = 1 and p(m)=0p(m) = 0 for m<0m < 0. Although the index says infinity, the sum is finite: the arguments turn negative almost immediately.

In the case of p(12)=77p(12) = 77:

  1. 1212
  2. 11+111 + 1
  3. 10+1+110 + 1 + 1
  4. 10+210 + 2
  5. 8+1+1+28 + 1 + 1 + 2

These are the ways of adding up to 12.

But

8+1+1+2=8+1+2+18 + 1 + 1 + 2 = 8 + 1 + 2 + 1

by the definition of partitions. In music, however, an interval of 8 semitones followed by 1 semitone, 1 semitone and 2 semitones is not the same as one of 8 semitones, 1 semitone, 2 semitones, 1 semitone. Written as tuples:

(8,1,1,2)(8,1,2,1)(8, 1, 1, 2) \neq (8, 1, 2, 1)

And on the chromatic circle:

Two different 4-note scales shown on the chromatic circle
Two different 4-note scales shown on the chromatic circle

That is, there are 77 ways of adding up to 12. But this does not mean there are 77 distinct scales in our musical space of 12 semitones. We have fallen short. In a partition, two sums with the same terms count as equal. In music they do not. The order of the terms does matter.

That leads us to the next question.

2. How many sums adding up to 12 can be made where the order of the terms matters?

When order matters, these are called compositions. In compositions the number of terms does not matter, but the order does. This number will be greater than 77, because each partition generates one or more compositions by reordering its terms.

What is a composition?

In mathematics, a composition of an integer nn is a way of writing nn as the sum of a sequence of strictly positive integers. Two sequences that differ in the order of their terms define different compositions of their sum, while they are considered to define the same integer partition of that number. Every integer has a finite number of distinct compositions. Each positive integer nn has 2n12^{n-1} distinct compositions.

Total number of compositions of a number nn

k=1n(n1k1)=2n1\sum_{k=1}^{n} \binom{n-1}{k-1} = 2^{n-1}

So for 12 semitones there are 2112^{11} possibilities, that is, 2048.

211=20482^{11} = 2048

This includes every scale that can be formed with 1, 2, 3, 4, etc. pitches. For instance, here we have 1212, the only 1-note scale that can be formed. Also (2,2,2,2,2,2)(2, 2, 2, 2, 2, 2), the whole-tone scale. We are interested in 9-note scales, so this time we have overshot. We need a subset of this set in which the number of terms is 9.

3. How many sums of 9 terms adding up to 12 can be made, where the order of the terms matters?

For this problem, we are looking for the number of compositions of 12 into exactly 9 parts. A composition is similar to a partition, but the order of the terms does matter.

We can solve this problem with the "stars and bars" method. Imagine 12 stars representing the number 12.

12 stars
12 stars

We need to split these 12 stars into 9 groups (9 terms). To do that, we need to place 8 "bars" in the gaps between the stars. There are 121=1112 - 1 = 11 possible gaps where we can place the bars:

12 stars and the 11 places where a bar can go
12 stars and the 11 places where a bar can go

Now the problem is binary. In a gap we have two options: we place a bar or we do not. To split these stars into 9 groups, we need to choose 8 of these 11 gaps to place the bars in.

3 ways of combining the bars across the gaps
3 ways of combining the bars across the gaps

It is therefore a matter of finding every combination of added bars: a binomial coefficient. Since we are thinking in terms of gaps, there are (number of stars) − 1 gaps in which to choose (number of groups) − 1 bars. Hence the 1-1 terms in the formula, usually written as follows:

(n1k1)\binom{n-1}{k-1}

In this case, n=12n = 12 and k=9k = 9.

(12191)=(118)\binom{12-1}{9-1} = \binom{11}{8}

So we can use the combinations of nn taken kk at a time to get our number of 9 terms summing to 12. Since:

(nr)=n!r!(nr)!\binom{n}{r} = \frac{n!}{r!\,(n-r)!}

This gives us 165. There are 165 nine-note scales in the 12 pitch-class system.

Again, the answer is no. Because, again, we have overshot. It turns out that this set also contains the modes of one and the same scale. So there are more combinations than we would musically want.

4. How many sums of 9 terms adding up to 12 can be made, where the order of the terms matters and no sum is a cyclic shift of another?

Let us see what this question means. So far, with each question we have been adding restrictions to get closer to what we want. We already understand the first parts; only "is not a cyclic shift of another" may be unclear.

A musical scale can begin on any pitch class: as long as it keeps the same succession of semitones, it is considered the same scale. We call this transposition. But a scale can also begin at any point within its own succession of semitones and still be the same scale; that we call a mode.

Since we are working with intervals in units of 1 semitone, transpositions are not our concern. They do not appear in the sets we are computing.

Some examples:

  1. The diatonic scale (2,2,1,2,2,2,1)(2, 2, 1, 2, 2, 2, 1) has 12 transpositions and 7 modes when the octave is divided into 12 parts (as in equal temperament).
  2. The whole-tone scale (2,2,2,2,2,2)(2, 2, 2, 2, 2, 2) has 2 transpositions and 1 mode.

How do we tell whether a sequence of terms is a "mode" in the musical sense? We look at its cyclic shifts. One numeric sequence is a cyclic shift of another if, by starting at a different place and moving to the right, I obtain the second one.

Rotations 1 2 3, 2 3 1, 3 1 2: they form one cycle
Rotations 1 2 3, 2 3 1, 3 1 2: they form one cycle

However, (1,3,2)(1, 3, 2) is not part of this cycle, because there is no way to start our original sequence at a different position and arrive at this sequence, even though it has the same terms.

It is worth noting here that these cycles are not permutations. The permutations of 1, 2 and 3 are:

  1. 1,2,31, 2, 3
  2. 2,3,12, 3, 1
  3. 3,1,23, 1, 2
  4. 1,3,21, 3, 2
  5. 3,2,13, 2, 1
  6. 2,1,32, 1, 3

These permutations contain 2 cycles: (1,2,3)(1, 2, 3) and (1,3,2)(1, 3, 2).

Cycles are the same thing as modes. So, within the set we obtained earlier (165), we have to recognise the cycles and collapse each one into a single sequence. This is no longer so easy to get.

One solution is to start iterating over these 165 sequences and, for each one, find its cyclic shifts and remove them from the set. That is, brute force. In the end we would be left with a set giving the exact number of 9-note scales. What is that number? 165 is a large number to start writing out one by one and checking. We need to be cleverer.

First let us try to find out how many scales there are in total. For that we need some mathematics.

Cyclic compositions

A cyclic composition of an integer nn is an equivalence class of linear compositions of nn, where two compositions are considered equivalent if one can be obtained from the other by a cyclic shift of its parts.

Think of the parts of the composition arranged in a circle, as on the chromatic circle. If we rotate the circle, the composition is still the same. These are also said to form an orbit.

Example of linear compositions and their equivalent cyclic compositions

For n=4n = 4:

  1. Linear compositions:
    • 44
    • 3+13 + 1
    • 1+31 + 3
    • 2+22 + 2
    • 2+1+12 + 1 + 1
    • 1+2+11 + 2 + 1
    • 1+1+21 + 1 + 2
    • 1+1+1+11 + 1 + 1 + 1
  2. Cyclic compositions (equivalence classes):
    • [4][4] (there is only one linear form, 4)
    • [3,1][3, 1] and [1,3][1, 3] collapse into the single cyclic composition (3,1)(3, 1)
    • [2,2][2, 2] (this one is "cyclically symmetric", so it is its own class)
    • [2,1,1][2, 1, 1], [1,2,1][1, 2, 1], [1,1,2][1, 1, 2] collapse into the single cyclic composition (2,1,1)(2, 1, 1)
    • [1,1,1,1][1, 1, 1, 1] (also cyclically symmetric)

So the cyclic compositions of 4 are:

  1. (4)(4)
  2. (3,1)(3, 1)
  3. (2,2)(2, 2)
  4. (2,1,1)(2, 1, 1)
  5. (1,1,1,1)(1, 1, 1, 1)

There are 5 cyclic compositions of 4. We observe that the number of cyclic compositions is often smaller than the number of linear compositions.

How are cyclic compositions counted?

Counting cyclic compositions is more involved than counting linear ones: there is no formula as direct as 2n12^{n-1} or (n1k1)\binom{n-1}{k-1}, because we have to count equivalence classes under rotation.

We need more advanced combinatorial tools, such as Burnside's lemma or the Pólya enumeration theorem, which count objects under the action of a group of symmetries; in our case, the cyclic group of rotations.

The general formula for the number of cyclic compositions of nn (with no restriction on the number of parts) is:

1ndnϕ(d)2n/d1\frac{1}{n}\sum_{d\mid n}\phi(d)\cdot 2^{n/d} - 1

where ϕ(d)\phi(d) is Euler's totient function, which counts the positive integers less than or equal to dd that are coprime with dd. The sum counts the binary necklaces of length nn (at each of the nn semitones, either a part begins or it does not); the 1-1 discards the necklace with no marks at all, which corresponds to no composition. We can check the formula against our example: for n=4n = 4 it gives 14(24+22+22)1=61=5\frac{1}{4}\left(2^4 + 2^2 + 2\cdot 2\right) - 1 = 6 - 1 = 5, the five cyclic compositions listed above. The full sequence is A008965 in the OEIS.

An example

φ(36)=φ ⁣(3222)=36(113)(112)=362312=12\varphi(36)=\varphi\!\left(3^{2}\,2^{2}\right)=36\left(1-\tfrac{1}{3}\right)\left(1-\tfrac{1}{2}\right)=36\cdot\tfrac{2}{3}\cdot\tfrac{1}{2}=12

Also:

φ(36)=φ ⁣(3222)=(31)3(21)(21)2(21)=2312=12\varphi(36)=\varphi\!\left(3^{2}\,2^{2}\right)=(3-1)\,3^{(2-1)}\,(2-1)\,2^{(2-1)}=2\cdot 3\cdot 1\cdot 2=12

It can be checked by hand that the numbers coprime with 36 (that is, divisible by neither 2 nor 3) are twelve: 1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31 and 35.

This formula answers the question we opened the section with: how many scales are there in total, of any number of pitches? For n=12n = 12, the divisors are 1, 2, 3, 4, 6 and 12:

112(1212+126+224+223+222+421)1=4224121=351\frac{1}{12}\left(1\cdot 2^{12} + 1\cdot 2^{6} + 2\cdot 2^{4} + 2\cdot 2^{3} + 2\cdot 2^{2} + 4\cdot 2^{1}\right) - 1 = \frac{4224}{12} - 1 = 351

In equal temperament there are 351 scales of between 1 and 12 pitches, counting the modes of a scale as one.

For our specific case of compositions of 12 into 9 parts under rotation, the problem is finer still, since we are fixing the number of parts (k=9k = 9). The formula becomes more specific:

1kdgcd(n,k)ϕ(d)(n/d1k/d1)\frac{1}{k} \sum_{d\,\mid\,\gcd(n,k)} \phi(d)\,\binom{n/d - 1}{k/d - 1}

What sits under the summation sign says which values are summed over: dd runs through the divisors of gcd(n,k)\gcd(n, k), the greatest common divisor of nn and kk — in our case, of 12 and 9. The last part

(n/d1k/d1)\binom{n/d - 1}{k/d - 1}

counts the linear compositions of n/dn/d into k/dk/d parts. It is the binomial coefficient we saw earlier.

Applying this to n=12n = 12, k=9k = 9:

gcd(12,9)=3\gcd(12, 9) = 3

The divisors of 3 are 1 and 3, so the sum runs over d=1d = 1 and d=3d = 3.

For d=1d = 1:

ϕ(1)=1\phi(1) = 1

The value to the right of the summation sign works out to:

1(12/119/11)=(118)=1651 \cdot \binom{12/1 - 1}{9/1 - 1} = \binom{11}{8} = 165

For d=3d = 3:

ϕ(3)=2\phi(3) = 2

The numbers coprime with 3 and less than or equal to 3 are 1 and 2. Therefore:

2(12/319/31)=2(4131)=2(32)=23=62 \cdot \binom{12/3 - 1}{9/3 - 1} = 2 \cdot \binom{4-1}{3-1} = 2 \cdot \binom{3}{2} = 2 \cdot 3 = 6

At last, the number of cyclic compositions of 12 into 9 parts is:

19(ϕ(1)(118)+ϕ(3)(32))=19(1165+23)=19(165+6)=1719=19\frac{1}{9}\left(\phi(1)\,\binom{11}{8} + \phi(3)\,\binom{3}{2}\right) = \frac{1}{9}\left(1\cdot 165 + 2\cdot 3\right) = \frac{1}{9}(165 + 6) = \frac{171}{9} = 19

So, of the 165 linear compositions, there are only 19 distinct cyclic ones.

How many 9-note scales are there?

19.

Problem solved, but… can we list them?

How do I go about listing all 19 scales?

Here is a new challenge: enumerating the 19 cyclic compositions for n=12n = 12 and k=9k = 9 is fairly difficult and cannot be done with a formula for combinations alone. The formula we used gives us the total number of such cyclic compositions, but it does not generate them.

Generating all the cyclic compositions involves identifying cycles and reducing by the cyclic group. That is, we first have to generate all 165 linear compositions and then group them by their cyclic rotations and remove the duplicates.

Why it is hard to list them without a specific algorithm

  1. Generating 165 linear compositions. Even listing all 165 linear compositions by hand is error-prone and extremely tedious. It is easier to do it programmatically. One approach is to generate every combination of 8 "bars" across 11 "gaps" and then read each combination as a sequence of terms.
  2. Identifying cyclic equivalence. Once we have the 165, for each linear composition [x1,x2,,xk][x_1, x_2, \ldots, x_k] we would have to generate all kk of its rotations ([x2,,xk,x1]([x_2, \ldots, x_k, x_1], and so on). Then we would have to store each cyclic composition in a canonical form (for example, the lexicographically smallest rotation) to avoid counting the same equivalence class more than once.
  3. Filtering by equivalence class. Some compositions have fewer than kk distinct rotations (such as [1,1,2,1,1,2,1,1,2][1,1,2,1,1,2,1,1,2], which has only 3 unique rotations), which complicates the grouping. This comes from the internal symmetry of the composition (its period).

The 19 cyclic compositions are sets of sequences of 9 positive integers summing to 12, where each set represents an equivalence class under rotation.

Features of the 19 compositions:

  • Variety of intervals. There is a wide variety of combinations of 1, 2, 3 and perhaps a 4 to reach 12 in 9 parts.
    • The smallest possible term is 1.
    • The largest possible term is 4 (if all the others are 1: 1+1+1+1+1+1+1+1+4=121+1+1+1+1+1+1+1+4 = 12). There cannot be a 5, for example, because if there were, the other 8 terms would have to sum to 7, which is impossible if each is at least 1 (they would sum to at least 8).
  • Period. Some cyclic compositions have a period of 9 (that is, the 9 linear rotations are all distinct before the first one repeats). These are the "asymmetric" ones. Others have a shorter period: this happens when the composition is the result of repeating a smaller pattern. Since the period must divide k=9k = 9, it can only be 1, 3 or 9.

So:

  • There will be no compositions of period 1, since that would mean all the terms are equal, and 12/9 is not an integer.
  • With period 3 there is exactly one. The repeating block of 3 terms must sum to 12/3=412/3 = 4, and the three compositions of 4 into 3 parts —(1,1,2)(1, 1, 2), (1,2,1)(1, 2, 1) and (2,1,1)(2, 1, 1)— are rotations of one another: the only class is (1,1,2,1,1,2,1,1,2)(1, 1, 2, 1, 1, 2, 1, 1, 2).
  • The other 18 have period 9.

This gives an independent check on the result: 189+13=16518 \cdot 9 + 1 \cdot 3 = 165, exactly the number of linear compositions.

The script below first generates all the linear compositions and then groups them into their respective cyclic classes. For each class, it presents the lexicographically smallest linear composition as its representative.

import math
# We use itertools.combinations to choose the bar positions
from itertools import combinations


def generate_compositions(n, k):
    """
    Generates all linear compositions of n into k parts.
    Uses the stars and bars method,
    representing the bars as combinations.
    """
    if n < k or k <= 0:
        return []

    compositions = []

    # The 'gaps' are the indices where bars can be placed
    spaces = range(1, n)

    # Generate every combination of k-1 bars across n-1 gaps
    for bar_positions in combinations(spaces, k - 1):
        current_composition = []
        last_bar_pos = 0
        for bar_pos in bar_positions:
            current_composition.append(bar_pos - last_bar_pos)
            last_bar_pos = bar_pos
        current_composition.append(n - last_bar_pos)
        compositions.append(tuple(current_composition))
    return compositions


def get_cyclic_rotations(composition):
    """
    Gets all cyclic rotations of a given composition.
    """
    rotations = []
    k = len(composition)
    for i in range(k):
        rotated_composition = composition[i:] + composition[:i]
        rotations.append(tuple(rotated_composition))
    return rotations


def get_lexicographically_smallest(composition_list):
    """
    Returns the lexicographically smallest
    composition from a list of compositions.
    """
    return min(composition_list)


# Define n and k
n = 12  # The total sum
k = 9   # The number of parts

# --- Running the script ---

print(f"Generating cyclic compositions for n={n} (sum) and k={k} (number of parts):\n")

# 1. Generate all the linear compositions
linear_compositions = generate_compositions(n, k)
print(f"Total linear compositions (where order matters): {len(linear_compositions)}\n")

# 2. Identify the cyclic equivalence classes
cyclic_classes = set()  # A set will hold the unique representatives

for comp in linear_compositions:
    # Get every rotation of the current composition
    rotations = get_cyclic_rotations(comp)

    # Find the lexicographically smallest rotation for this class
    # This will be our canonical representative for the cyclic class
    canonical_representative = get_lexicographically_smallest(rotations)

    # Add the canonical representative to the set of cyclic classes
    cyclic_classes.add(canonical_representative)

# Convert the set to a list and sort it for consistent output
sorted_cyclic_compositions = sorted(list(cyclic_classes))

print(f"Total cyclic compositions (where rotations are equivalent): {len(sorted_cyclic_compositions)}\n")

print("List of the 19 cyclic compositions (given by their lexicographically smallest form):")
for i, comp in enumerate(sorted_cyclic_compositions):
    print(f"{i+1}. {list(comp)}")

Let us go through the code:

generate_compositions(n, k)

  • This function takes nn (the sum) and kk (the number of parts).
  • It uses the stars and bars principle. If we have nn stars, there are n1n - 1 gaps between them. To split those stars into kk parts (all positive), we need to place k1k - 1 bars in those n1n - 1 gaps.
  • itertools.combinations is a tool that generates every way of choosing k1k - 1 bar positions from the n1n - 1 available gaps.
  • For each combination of bar positions, it computes the length of each segment (the "part" of the composition) and appends it to the list of compositions.

get_cyclic_rotations(composition)

  • Takes a linear composition (a tuple of numbers).
  • Generates all kk possible rotations of that composition. For example, if the composition is (a,b,c)(a, b, c), its rotations are (a,b,c)(a, b, c), (b,c,a)(b, c, a) and (c,a,b)(c, a, b).

get_lexicographically_smallest(composition_list)

  • This function simply finds the "smallest" composition in a list of tuples. Tuples are compared element by element (lexicographically). For example, (1,1,2)(1, 1, 2) is lexicographically smaller than (1,2,1)(1, 2, 1). This is essential in order to have a canonical representative for each cyclic equivalence class.

Main logic

  • First, all 165 linear compositions are generated.
  • Then the script iterates through each of these linear compositions.
  • For each one, it generates all its possible rotations.
  • Of those rotations, it finds the lexicographically smallest one. This becomes the unique "name" of its cyclic equivalence class.
  • This canonical representative is added to a set of cyclic classes. Python sets handle uniqueness automatically, ensuring no duplicate cyclic classes are added.
  • Finally, the contents of the set are converted to a list and sorted, to present the results cleanly and consistently.

This script can be run anywhere with Python. Its output is the full list of the 19 scales, each given by its lexicographically smallest rotation:

  1. (1,1,1,1,1,1,1,1,4)(1, 1, 1, 1, 1, 1, 1, 1, 4)
  2. (1,1,1,1,1,1,1,2,3)(1, 1, 1, 1, 1, 1, 1, 2, 3)
  3. (1,1,1,1,1,1,1,3,2)(1, 1, 1, 1, 1, 1, 1, 3, 2)
  4. (1,1,1,1,1,1,2,1,3)(1, 1, 1, 1, 1, 1, 2, 1, 3)
  5. (1,1,1,1,1,1,2,2,2)(1, 1, 1, 1, 1, 1, 2, 2, 2)
  6. (1,1,1,1,1,1,3,1,2)(1, 1, 1, 1, 1, 1, 3, 1, 2)
  7. (1,1,1,1,1,2,1,1,3)(1, 1, 1, 1, 1, 2, 1, 1, 3)
  8. (1,1,1,1,1,2,1,2,2)(1, 1, 1, 1, 1, 2, 1, 2, 2)
  9. (1,1,1,1,1,2,2,1,2)(1, 1, 1, 1, 1, 2, 2, 1, 2)
  10. (1,1,1,1,1,3,1,1,2)(1, 1, 1, 1, 1, 3, 1, 1, 2)
  11. (1,1,1,1,2,1,1,1,3)(1, 1, 1, 1, 2, 1, 1, 1, 3)
  12. (1,1,1,1,2,1,1,2,2)(1, 1, 1, 1, 2, 1, 1, 2, 2)
  13. (1,1,1,1,2,1,2,1,2)(1, 1, 1, 1, 2, 1, 2, 1, 2)
  14. (1,1,1,1,2,2,1,1,2)(1, 1, 1, 1, 2, 2, 1, 1, 2)
  15. (1,1,1,1,3,1,1,1,2)(1, 1, 1, 1, 3, 1, 1, 1, 2)
  16. (1,1,1,2,1,1,1,2,2)(1, 1, 1, 2, 1, 1, 1, 2, 2)
  17. (1,1,1,2,1,1,2,1,2)(1, 1, 1, 2, 1, 1, 2, 1, 2)
  18. (1,1,1,2,1,2,1,1,2)(1, 1, 1, 2, 1, 2, 1, 1, 2)
  19. (1,1,2,1,1,2,1,1,2)(1, 1, 2, 1, 1, 2, 1, 1, 2)

We can also arrive at this list by drawing, however. Let us see how.

Another way of drawing

We could still use the chromatic circle to describe every scale. But the chromatic circle ties each point (or tick mark) to a pitch (whatever its name), and the separation between 2 consecutive points means one semitone. It seems to me that the chromatic circle focuses on pitch classes, while my whole approach to describing scales centres on their distances counted in semitones. So I do not find the chromatic circle particularly illuminating here.

Chromatic circle with 12 tick marks
Chromatic circle with 12 tick marks

We are going to use boxes instead.

I will base this on Young diagrams, a way of representing the partitions of a number. Information can be found on Wikipedia: Young tableau, but there is no need to know much beyond what I explain below.

Each box represents 1 semitone. Since the scales we are after have 9 pitches, we will lay them out in 9 rows. That way we make sure there are 9 pitches. But we still have to define the distances between those pitches. Since there must be 12 semitones for the cycle to close, we have 3 boxes left to place.

9 rows with 1 box each: the 9 "steps" needed to close the scale
9 rows with 1 box each: the 9 "steps" needed to close the scale

With boxes, there is no need to work out in advance how to distribute the semitones. They get added on the right, while the steps are already determined. The chromatic circle, on the other hand, expresses the cyclic nature of scales better.

We are 3 boxes short of 12 boxes (12 semitones). How do we distribute them? We cannot go on adding rows, because then the resulting scale would no longer have 9 steps (or pitches). So we are going to add them beside the boxes already placed. We will do it to the right, though the side makes no difference. This way we do not change the number of rows.

In how many ways can we stack those 3 remaining boxes? Not many:

  • We stack the 3 boxes in one row.
  • We stack 1 box in one row and 2 boxes in another row.
  • We stack 1 box in each of 3 rows.

These are the partitions of the number 3! So some rows will have 4, 3 or 2 boxes.

The key is to place these boxes from the bottom up and count from the top down. This gives us a systematic way of counting, secures the basic form and avoids cycles. We could count from the bottom up; that would give us the inverse scale: the one that results from reading the interval sequence in the opposite order (on the chromatic circle, its reflection). It amounts to the same thing. But to avoid duplicates it is important to stick to one of the two ways of counting.

We first place the largest box in the last row, then the next one in the second-to-last row, and so on. When two rows have the same number of boxes, their order does not matter.

Three ways of completing the 12 boxes: (1,1,1,1,1,1,1,1,4), (1,1,1,1,1,1,1,2,3) and (1,1,1,1,1,1,2,2,2)
Three ways of completing the 12 boxes: (1,1,1,1,1,1,1,1,4), (1,1,1,1,1,1,1,2,3) and (1,1,1,1,1,1,2,2,2)

So now all that is left is to move the rows that have more than one box, in order to obtain every scale. But we always leave the last row with the largest number of boxes.

Let us see why this works. In numeric form, we have (1,1,1,1,1,1,1,2,3)(1, 1, 1, 1, 1, 1, 1, 2, 3). What we do is move the 2 to the left and leave the 3 where it is. This gives every possibility with 2 and 3 semitones. When we reach this: (2,1,1,1,1,1,1,1,3)(2, 1, 1, 1, 1, 1, 1, 1, 3), we see there is nowhere left to go; any further move gives us a cycle.

(2,1,1,1,1,1,1,1,3)=(1,1,1,1,1,1,1,3,2)(2, 1, 1, 1, 1, 1, 1, 1, 3) = (1, 1, 1, 1, 1, 1, 1, 3, 2)

A concise notation

There is a more concise way of writing the sequences of 1, 2, 3 and 4. We can group the 1s when they are adjacent without losing information:

(1,1,1,1,1,1,1,1,4)=(8, 4)(1, 1, 1, 1, 1, 1, 1, 1, 4) = (8,\ \underline{4})

The ordinary number gives the count of 1s and the underlined number the count of boxes in that row. Let us look at a more elaborate example:

(1,2,1,1,1,2,1,1,2)=(1, 2, 3, 2, 2, 2)(1, 2, 1, 1, 1, 2, 1, 1, 2) = (1,\ \underline{2},\ 3,\ \underline{2},\ 2,\ \underline{2})

This makes the cycles easier to recognise. We also see that once the underlined numbers reach the ends, there are no further versions.

(1, 2, 3, 2, 2, 2)=(2, 3, 2, 2, 2, 1)=(3, 2, 2, 2, 1, 2)(1,\ \underline{2},\ 3,\ \underline{2},\ 2,\ \underline{2}) = (\underline{2},\ 3,\ \underline{2},\ 2,\ \underline{2},\ 1) = (3,\ \underline{2},\ 2,\ \underline{2},\ 1,\ \underline{2})

Carried over to the full version:

(1, 2, 3, 2, 2, 2)=(1,2,1,1,1,2,1,1,2)=(2,1,1,1,2,1,1,2,1)=(1,1,1,2,1,1,2,1,2)(1,\ \underline{2},\ 3,\ \underline{2},\ 2,\ \underline{2}) = (1, 2, 1, 1, 1, 2, 1, 1, 2) = (2, 1, 1, 1, 2, 1, 1, 2, 1) = (1, 1, 1, 2, 1, 1, 2, 1, 2)\ldots

And using another version, we end up writing fewer cycles without losing information:

(3, 2, 2, 2, 1, 2)=(1,1,1,2,1,1,2,1,2)=(1,1,2,1,1,2,1,2,1)=(1,2,1,1,2,1,2,1,1)=(2,1,1,2,1,2,1,1,1)=(1,1,2,1,2,1,1,1,2)(3,\ \underline{2},\ 2,\ \underline{2},\ 1,\ \underline{2}) = (1, 1, 1, 2, 1, 1, 2, 1, 2) = (1, 1, 2, 1, 1, 2, 1, 2, 1) = (1, 2, 1, 1, 2, 1, 2, 1, 1) = (2, 1, 1, 2, 1, 2, 1, 1, 1) = (1, 1, 2, 1, 2, 1, 1, 1, 2)

For the full version there are 9 ways of writing it, while for the concise version there are 6. And this is the longest one among the 9-note scales.

For instance, (7, 2, 3)(7,\ \underline{2},\ \underline{3}) is more concise still. And its cycles are easy to obtain: (2, 3, 7)(\underline{2},\ \underline{3},\ 7) and (3, 7, 2)(\underline{3},\ 7,\ \underline{2}). Compare that with the 9 cycles to be written out in the full version. What is more, we see that (7, 2, 3)(7,\ \underline{2},\ \underline{3}) differs from (7, 3, 2)(7,\ \underline{3},\ \underline{2}).

The key is never to move the boxes in the last row, which will always be the one with the most boxes.

Let us list every possibility under the restrictions that apply to a scale.

Using 4 boxes

There is only one version, since any other is a mode of the same one:

Scale (8, 4): a column of 8 boxes with 4 boxes at the foot
Scale (8, 4): a column of 8 boxes with 4 boxes at the foot

Using 2 and 3 boxes

These are the 8 versions:

The 8 versions with 2 and 3 boxes: (7,2,3), (6,2,1,3), (5,2,2,3), (4,2,3,3), (3,2,4,3), (2,2,5,3), (1,2,6,3) and (2,7,3)
The 8 versions with 2 and 3 boxes: (7,2,3), (6,2,1,3), (5,2,2,3), (4,2,3,3), (3,2,4,3), (2,2,5,3), (1,2,6,3) and (2,7,3)

The cycles are easy to see:

(7, 2, 3)=(2, 3, 7)=(3, 7, 2)(7,\ \underline{2},\ \underline{3}) = (\underline{2},\ \underline{3},\ 7) = (\underline{3},\ 7,\ \underline{2})

Its inverse appears in the last drawing:

(2, 7, 3)=(7, 3, 2)=(3, 2, 7)(\underline{2},\ 7,\ \underline{3}) = (7,\ \underline{3},\ \underline{2}) = (\underline{3},\ \underline{2},\ 7)

Using 2 boxes

There are 10 versions using 3 rows with 2 boxes:

The six scales with three rows of 2 boxes whose longest initial run is 6, 5 or 4 ones: (1,1,1,1,1,1,2,2,2), (1,1,1,1,1,2,1,2,2), (1,1,1,1,1,2,2,1,2), (1,1,1,1,2,1,1,2,2), (1,1,1,1,2,2,1,1,2) and (1,1,1,1,2,1,2,1,2)
The six scales with three rows of 2 boxes whose longest initial run is 6, 5 or 4 ones: (1,1,1,1,1,1,2,2,2), (1,1,1,1,1,2,1,2,2), (1,1,1,1,1,2,2,1,2), (1,1,1,1,2,1,1,2,2), (1,1,1,1,2,2,1,1,2) and (1,1,1,1,2,1,2,1,2)
The remaining four: (1,1,1,2,1,1,1,2,2), (1,1,1,2,1,1,2,1,2), (1,1,1,2,1,2,1,1,2) and (1,1,2,1,1,2,1,1,2)
The remaining four: (1,1,1,2,1,1,1,2,2), (1,1,1,2,1,1,2,1,2), (1,1,1,2,1,2,1,1,2) and (1,1,2,1,1,2,1,1,2)

Because the 3 boxes are distributed one to a different row each, the following holds: the row with the most boxes always goes last, and the largest grouping of 1s always goes first. When that largest grouping of 1s sits in the intermediate rows, that arrangement has already been listed.

(4, 2, 2, 2, 2)(4,\ \underline{2},\ 2,\ \underline{2},\ \underline{2}) is a cycle of (2, 2, 2, 4, 2)(2,\ \underline{2},\ \underline{2},\ 4,\ \underline{2})

In the version with 2 and 3 boxes, when the largest distribution of 1s falls in the intermediate rows, the inverse is obtained. In the version with 2, 2 and 2 boxes both things happen: there are three pairs of inverses —for example, (3, 2, 2, 2, 1, 2)(3,\ \underline{2},\ 2,\ \underline{2},\ 1,\ \underline{2}) and (3, 2, 1, 2, 2, 2)(3,\ \underline{2},\ 1,\ \underline{2},\ 2,\ \underline{2})— and four scales that are their own inverse, among them the period-3 one, (2, 2, 2, 2, 2, 2)(2,\ \underline{2},\ 2,\ \underline{2},\ 2,\ \underline{2}).

Conclusion

Over the course of this article we have uncovered an intricate weave between the seemingly abstract mathematics of combinatorics and the tangible world of musical creativity. For me, creativity starts as some question, interesting or not. And the matter of how many distinct sums can form a number evolved into a broader exploration of the structures that make up musical scales.

We showed that the problem of building 9-note scales on the chromatic circle of 12 semitones maps directly onto the mathematical concept of cyclic compositions. Unlike partitions, where order does not matter, compositions take account of the sequence of their elements, reflecting the importance of the series of intervals in a scale. In the cyclic context of the chromatic circle, however, the rotations of one and the same interval sequence define a single scale structure, revealing that of the 165 possible linear compositions, only 19 are musically distinct interval structures.

We were able to develop a constructive method and a concise notation system. This method, based on the distribution of surplus "boxes" or semitones and the grouping of "ones", shows a thorough grasp of how these canonical forms are generated without the need for massive filtering after the fact. The capacity of this system to recognise cyclic equivalences and internal symmetries visually underlines how structured logic can sharpen creative perception.

Ultimately, this joint exploration reveals that mathematics is not only a tool for calculation, but a powerful language for describing, analysing and even inspiring creativity. Music, in essence, is full of patterns and symmetries that combinatorics helps us unravel, offering new perspectives for composition and music theory. This dialogue between disciplines opens paths for future discoveries at the intersection of art and science.

Appendix 1 — The 19 scales on the chromatic circle

Scale (8, 4) on the chromatic circle
Scale (8, 4) on the chromatic circle
Eight scales using 2 and 3 boxes, with their inversion/reflection relations
Eight scales using 2 and 3 boxes, with their inversion/reflection relations
Scales using three rows of 2 boxes, with their inversion/reflection relations
Scales using three rows of 2 boxes, with their inversion/reflection relations
Scale (2, 2, 2, 2, 2, 2) with internal symmetry and limited transposition
Scale (2, 2, 2, 2, 2, 2) with internal symmetry and limited transposition