Starting at 1-TET, give equal temperaments that have better and better approximation of the perfect fifth(just ratio 3/2). (OEIS sequence A060528)
The formal description of the sequence, copied from the OEIS:
A list of equal temperaments (equal divisions of the octave) whose nearest scale steps are closer and closer approximations to the ratios of two tones of musical harmony: the perfect 4th, 4/3 and its complement the perfect 5th, 3/2.
Note that by symmetry, the perfect fourth doesn't matter.
Let's say we know that 3 is in the sequence. The frequencies in 3-TET are:
2^0, 2^⅓, 2^⅔
Where 2^⅔
is the closest logarithmic approximation of 3/2
.
Is 4 in the sequence? The frequencies in 4-TET are:
2^0, 2^¼, 2^½, 2^¾
Where 2^½
is the closest approximation of 3/2
. This is not better than 2^⅔
, so 4 is not in the sequence.
By similar method, we confirm that 5 is in the sequence, and so on.
When given an integer n
as input, the output must be the first N numbers of the sequence in order. For example, when n = 7
, the output should be:
1 2 3 5 7 12 29
Sequence description by xnor
The irrational constant \$ \log_2(3) \approx 1.5849625007211563\dots\$ can be approximated by a sequence of rational fractions
$$ \frac{2}{1}, \frac{3}{2}, \frac{5}{3}, \frac{8}{5}, \frac{11}{7}, \frac{19}{12}, \frac{46}{29}, \dots$$
A fraction is included in the sequence if it's the new closest one by absolute distance \$ \left| \frac{p}{q} - \log_2(3)\ \right|\$, that is, closer than any other fraction with a smaller or equal denominator.
Your goal is to output the first \$n\$ denominators in order. These are sequence A060528 (table). The numerators (not required) are given by A254351 (table)
Rules:
- Do not import the sequence A060528 directly.
The format doesn't matter as long as the numbers are distinguishable. In the example above, the output can also be:
[1,2,3,5,7,12,29]
As this is a code-golf, the shortest code in bytes wins.