cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A328883 Denominators of the best rational approximations of log(6/5)/log(2).

This page as a plain text file.
%I A328883 #35 Jun 22 2025 14:13:44
%S A328883 1,2,3,4,11,15,19,232,251,270,289,308,327,346,365,384,403,422,1285,
%T A328883 1707,2129,3836,28981,32817,36653,40489,44325,48161,51997,3591629,
%U A328883 3643626,3695623,3747620,3799617,3851614,3903611,3955608,4007605,4059602,4111599,4163596,4215593
%N A328883 Denominators of the best rational approximations of log(6/5)/log(2).
%C A328883 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 minor third, 6/5 and its complement the major sixth, 5/3.
%C A328883 The numerical value of each term represents a musical scale based on an equal division of the octave. 19, for example, signifies the scale which is formed by dividing the octave into 19 equal parts.
%C A328883 The 19 equal temperament, first proposed and used by Guillaume Costeley in the 16th century, uses 19 equally spaced tones, offering better major thirds and far better minor thirds than normal 12-semitone equal temperament at the cost of a flatter fifth.
%H A328883 Wikipedia, <a href="https://en.wikipedia.org/wiki/Guillaume_Costeley">Guillaume Costeley</a>
%H A328883 <a href="/index/Mu#music">Index entries for sequences based on music</a>
%o A328883 (Python)
%o A328883 import decimal
%o A328883 from math import floor
%o A328883 from decimal import Decimal as D
%o A328883 from collections import namedtuple
%o A328883 def continued_fraction(x, k):
%o A328883     cf = []
%o A328883     q = floor(x)
%o A328883     cf.append(q)
%o A328883     x = x - q
%o A328883     i = 0
%o A328883     while x != 0 and i < k:
%o A328883         q = floor(1 / x)
%o A328883         if q > k:
%o A328883             break
%o A328883         cf.append(q)
%o A328883         x = 1 / x - q
%o A328883         i += 1
%o A328883     return cf
%o A328883 def best_rational_approximation(clist, app):
%o A328883     hn0, kn0 = 0, 1
%o A328883     hn1, kn1 = 1, 0
%o A328883     ran, rad = 0, 0
%o A328883     conlist, finallist = [], []
%o A328883     fraction = namedtuple("fraction", "ratio, denom")
%o A328883     for n in clist:
%o A328883         for i in range(1, n + 1):
%o A328883             ran = hn0 + (i * hn1)
%o A328883             rad = kn0 + (i * kn1)
%o A328883             try:
%o A328883                 if D.copy_abs(app-D(ran)/D(rad)) < D.copy_abs(app-D(hn1)/D(kn1)):
%o A328883                     conlist.append(fraction(f'{ran}/{rad}', rad))
%o A328883             except:
%o A328883                 pass
%o A328883         hn2 = (n * hn1) + hn0
%o A328883         kn2 = (n * kn1) + kn0
%o A328883         conlist.append(fraction(f'{hn2}/{kn2}', kn2))
%o A328883         hn0, kn0 = hn1, kn1
%o A328883         hn1, kn1 = hn2, kn2
%o A328883     #Change x.denom to x.ratio for the full ratio as a string
%o A328883     finallist = [ x.denom for x in sorted(conlist, key=lambda i: i.denom) ]
%o A328883     return list(dict.fromkeys(finallist))
%o A328883 if __name__ == "__main__":
%o A328883     prec = 200
%o A328883     decimal.getcontext().prec = prec
%o A328883     value = D(6/5).ln()/D(2).ln()
%o A328883     vc = continued_fraction(value, prec)
%o A328883     print(', '.join([str(x) for x in best_rational_approximation(vc, value)]))
%Y A328883 Cf. A054540, A060525, A060526, A060527, A060528, A061918, A254351.
%K A328883 nonn,frac
%O A328883 1,2
%A A328883 _Daniel Hoyt_, Oct 29 2019