# Arity

An *n***-ary scale** is a scale with exactly *n* distinct step sizes; a scale's **arity** is the number of distinct step sizes it has. **Unary**, **binary**, **ternary**, and **quaternary** scales are scales with exactly 1, 2, 3, and 4 step sizes, respectively.

Unary scales are equal tunings. The class of binary scales consists of all MOS scales and every alteration-by-permutation of a MOS scale, but do not include altered MOS scales such as the harmonic minor scale, msmmsLs, which gain additional step sizes from the alteration. Ternary scales are much less well-understood than binary ones, but one well-studied type of ternary scales is the class of generator-offset scales. Most known facts about ternary scales on the wiki can be found on the page rank-3 scale (which is mostly about specifically ternary scales).

## History of the term

The terms *binary* and *ternary* are already used in some academic literature in reference to words over an alphabet, in particular to circular words that represent abstract scales; see e.g. Bulgakova, Buzhinsky and Goncharov (2023), "On balanced and abelian properties of circular words over a ternary alphabet". Our use of the term *arity* borrows an existing technical term and generalizes from this use of *binary*, *ternary*, and *n-ary* to refer to the number of letters in an alphabet in combinatorics on words; combinatorics-on-words literature often instead uses "word on *n* letters" or "alphabet with *n* letters" in the arbitrary-*n* case.

## Difference from scale rank

Certain abstract scale theorists in the xen community have taken to using the *n-ary* terminology in view of the subtlety of the notion of a scale's rank. Examples of this subtlety are:

- Equal tunings contain MOS scales and ternary scales, but the group generated by the step sizes in these tunings of the scales must be rank 1.
- Certain chroma-altered MOS scales, which are contained in the group generated by the period and the generator of the unaltered MOS are ternary. An example is harmonic minor in any non-edo diatonic tuning, a chroma-alteration of the diatonic MOS with step pattern msmmsLs.

The term *n-ary* disregards the rank of the group generated by the step sizes, although an *n*-ary scale is still, in a probabilistic sense, *generically* rank-*n* (the group generated by the *n* step sizes X_{i} > 0, *i* = 1, ..., *n*, has rank *n*, not lower, for *almost all* choices of X_{i}, in the same sense that almost all real numbers between 0 and 1 are irrational).

## Mathematical facts

### Counting scales of a given size on a given number of letters

For *r* ≥ 1, the number of possible patterns (up to rotation) for periodic scales of size *n* ≥ *r* on *r* ordered step sizes *x*_{1} > *x*_{2} > ... > *x*_{r} is

[math]\displaystyle{\dfrac{1}{n} \sum_{d\mid n} \phi(d) \sum_{j=1}^r (-1)^{r-j} {r \choose j} j^{n/d}} \\ =\displaystyle{\dfrac{r!}{n} \sum_{d\mid n} \phi(d) S(n/d, r)}[/math]

where [math]\phi[/math] is the Euler totient function and [math]S(n, r)[/math] is the Stirling number of the second kind which counts ways to partition an *n*-element set into *r* distinguished parts.

## List of named ternary scales

The following is a list of (temperament-agnostic) names that have been given to ternary scales. We ignore the exact arrangement of scale words here.

### 7 notes

- nicetone (3L 2M 2S)
- omnidiatonic (2L 3M 2S)
- smicot (3L 1M 3S)
- dualdye (5L 1M 1S)

### 8 notes

- porcusmine (4L 3M 1S)
- pinedye (5L 2M 1S)

### 9 notes

### 10 notes

- blackdye (5L 2M 3S)
- blackville (2L 5M 3S)
- blackbuzz (5L 3M 2S)

### 11 notes

### 12 notes

- diachromedye (5L 2M 5S)

### 14 notes

- whitedye (5L 2M 7S)