Diamonds

Given a list of numbers, say [1, 3, 5, 7], find all ratios

    1       3       5       7

1   1/1     3/1     5/1     7/1

3   1/3     3/3     5/3     7/3

5   1/5     3/5     5/5     7/5

7   1/7     3/7     5/7     7/7

and reduce within one octave

    1       3       5       7

1   1/1     3/2     5/4     7/4

3   4/3     1/1     5/3     7/6

5   8/5     6/5     1/1     7/5

7   8/7    12/7    10/7     1/1

The unique ratios 1/1, 8/7, 7/6, 6/5, 5/4, 4/3, 7/5, 10/7, 3/2, 8/5, 5/3, 12/7, 7/4 form the [1, 3, 5, 7] diamond.

Further reading

Python code
from fractions import Fraction
from math import log2, floor


def reduce(x):
    return x * Fraction(2) ** (-floor(log2(x)))


def diamond(A):
    """
    >>> diamond([1, 3, 5])
    [Fraction(1, 1), Fraction(6, 5), Fraction(5, 4), Fraction(4, 3), Fraction(3, 2), Fraction(8, 5), Fraction(5, 3)]
    """
    return sorted(set(reduce(Fraction(x, y)) for x in A for y in A))

Scales

FileCall
xen12-hanson-12-ogdoadic-diamond diamond([1, 3, 5, 7, 9, 11, 13, 15])
xen12-wilson-06d-diamond diamond([1, 3, 5, 7])
xen12-wilson-14-diamond diamond([1, 3, 5, 7, 9, 11])
xen12-wilson-31-pentadic-diamond diamond([1, 5, 7, 11, 15])