# Stern scales

I mentioned in Three gaps, part 1 an article I have about xenharmonic musical scales, and in that article I mention a link between two-gap scales (MOS scales, as they’re somewhat reluctantly called there) and something called Stern’s diatomic series. As discussed previously, if you generate scales using a generator equal to $1200\log_2 (3/2)\approx 702$ cents, then you get two-gap scales with 2, 3, 5, 7, 12, 17… notes. Each of these numbers (starting with 5) is the sum of the immediately preceding number and one of the other preceding numbers:

5 = 3 + 2
7 = 5 + 2
12 = 7 + 5
17 = 12 + 5

and so on. Specifically each number is the sum of the immediately preceding one and one of the two numbers summed to make the immediately preceding one.

If you vary the generator by a small amount (and it’s still irrational) you get the same sequence to a point, and then it differs: for a musically significant example, a quarter comma tempered fifth, $1200\log_2 [(3/2)/(81/80)^{1/4}]\approx 697$ cents, the sequence is 2, 3, 5, 7, 12, 19… . Notice that the two numbers summed to make 12 are 7 and 5, and the two numbers summed to make 17 are 12, the immediately preceding one, and 5 which is one of the numbers in the sum for 12, while the two numbers summed to make 19 are 12 and 7, the other number in the sum for 12. Of course the sequence terminates if the generator is rational: for a generator of 700 cents, for example, it goes 2, 3, 5, 7; then the 8- through 11-note scales are all two-gap, and the 12-note scale is one-gap, i.e., an equal division of the octave. It stops there because further applications of the generator just give back notes you already have.

A generator for a 17-note equal division is $1200\times10/17 = 705\ 15/17$ cents and a generator for a 19-note equal division is $1200\times11/19 = 694\ 14/19$ cents. Generators between these two values (other than 700 cents) will give 2, 3, 5, 7, and 12 note two-gap scales, with ones below 700 going on to 19 and ones above 700 going on to 17. Generators a little outside that range will not give 12-note scales; they’ll go 2, 3, 5, 7, 9… if below the range or 2, 3, 5, 8, 13… if above. A diagram from which one can read off the 2-gap scales for generators from 685 to 720 cents is here, and for all generators from 600 to 1200 cents is here (the diagram for 0 to 600 cents is just a mirror image).

Stare at the first of those diagrams and you see 47 appears in two places. That is, the 47-note equal division can be generated by two different generators in that range: $1200\times27/47\approx 689$ cents and $1200\times28/47\approx 715$ cents.

In fact, looking at the whole range from 0 to 1200 cents, there must be 46 generators for a 47-note equal division: $1200\times n/47$ for $n = 1..46$. That’s because 47 is prime. For a 46-note equal division, though, $1200\times n/46$ will generate the scale only for odd $n$; even values will generate only a 23-note scale. And in general, the generators for an m-note equal division are $1200\times n/m$ for values of $n$ where $1\le n < m$ and n and m are relatively prime. The familiar 12-note equal division has only four generators: $1200\times 1/12$$1200\times 5/12$$1200\times 7/12$, and $1200\times 11/12$ cents.

Examine that diagram some more and you can see how it relates to a sequence of numbers developed as follows: Start with

5, 7

and interpolate the sum of the adjacent numbers

5, 12, 7

(in the diagram, 12 is linked to the horizontal lines associated with 5 and 7); and again

5, 17, 12, 19, 7

(17 is linked to 5 and 12, 19 to 12 and 7); and again

5, 22, 17, 29, 12, 31, 19, 26, 7

(22 is linked to 5 and 17, and so on); and again

5, 27, 22, 39, 17, 46, 29, 41, 12, 43, 31, 50, 19, 45, 26, 33, 7

ad infinitum. Those two values of 47 arise in later iterations of the this sequence from 27+5+5+5 and 33+7+7.

Likewise the big diagram and its mirror image relate to:

1, 1
1, 2, 1
1, 3, 2, 3, 1
1, 4, 3, 5, 2, 5, 3, 4, 1
1, 5, 4, 7, 3, 8, 5, 7, 2, 7, 5, 8, 3, 7, 4, 5, 1

et cetera. We can concatenate the rows of this, dropping the 1s from one end, into a single sequence:

1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1, 5, 4, 7, 3, 8, 5, 7, 2, 7, 5, 8, 3, 7, 4, 5, …

which we can define with the recurrence relation:

$b(1) = 1$
$b(2n) = b(n)$
$b(2n+1) = b(n) + b(n+1)$

This is known as Stern’s diatomic series, A002487 in OEIS.

From that definition it’s not at all obvious that, for instance, 47 will arise as a sum 46 times while 12 will arise as a sum only 4 times. It’s true though. In fact, consider the following sequence of rational numbers:

1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1, 1/4, 4/3, 3/5, 5/2, 2/5, 5/3, 3/4, 4/1…

That’s just each entry in Stern’s series divided by the subsequent entry. But there’s a theorem: The nth rational number, in reduced form, can be taken to be b(n)/b(n + 1), for n = 0, 1, 2 … That is, b(n) and b(n + 1) are relatively prime, and each positive reduced rational number occurs once and only once in the list b(0)/b(1), b(1)/b(2), … Or to put it another way, Stern’s series provides a way to enumerate the rational numbers.

The theorem’s proved in Calkin, N., & Wilf, H. (2000). Recounting the Rationals. The American Mathematical Monthly, 107(4), 360-363. doi:10.2307/2589182, if you want to look at it. Another fact about the series, also discussed there, is b(n) is the number of ways of writing the integer n as a sum of powers of 2, each power being used at most twice (i.e., once more than the legal limit for binary expansions).

Every positive integer appears in the list surrounded by two smaller numbers, which are relatively prime and sum to n, exactly once for each such possible distinct sum (counting m, n, n-m and n-m, n, m as distinct). So one finds 1, 12, 11; 5, 12, 7; 7, 12, 5; and 11, 12, 1; and no other instances of 12 adjacent to smaller numbers. On the other hand, one finds all 46 of 1, 47, 46; 2, 47, 45; 3, 47, 44; … 45, 47, 2; and 46, 47, 1.

Mind you, you have to look through a lot of numbers to find them. After all, 1 appears adjacent to $n$ and $n-1$ at position $2^{n-1}$ in the series: 1 followed by 2 and 1 is at position 2, 1 then 3 and 2 at position 4, 1 then 4 and 3 at position 8, and so on. 1 followed by 47 and 46 appears at position $2^{46} = 70,368,744,177,664$(!) So if you want to figure out how many numbers are smaller than and relatively prime to 47, examining Stern’s series may not be the best approach.