login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A328883 Denominators of the best rational approximations of log(6/5)/log(2). 0

%I #31 Nov 05 2019 10:38:51

%S 1,2,3,4,11,15,19,232,251,270,289,308,327,346,365,384,403,422,1285,

%T 1707,2129,3836,28981,32817,36653,40489,44325,48161,51997,3591629,

%U 3643626,3695623,3747620,3799617,3851614,3903611,3955608,4007605,4059602,4111599,4163596,4215593

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

%C 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 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 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 Wikipedia, <a href="https://en.wikipedia.org/wiki/Guillaume_Costeley">Guillaume Costeley</a>

%H <a href="/index/Mu#music">Index entries for sequences based on music</a>

%o (Python 3)

%o import decimal

%o from math import floor

%o from decimal import Decimal as D

%o from collections import namedtuple

%o def continued_fraction(x, k):

%o cf = []

%o q = floor(x)

%o cf.append(q)

%o x = x - q

%o i = 0

%o while x != 0 and i < k:

%o q = floor(1 / x)

%o if q > k:

%o break

%o cf.append(q)

%o x = 1 / x - q

%o i += 1

%o return cf

%o def best_rational_approximation(clist, app):

%o hn0, kn0 = 0, 1

%o hn1, kn1 = 1, 0

%o ran, rad = 0, 0

%o conlist, finallist = [], []

%o fraction = namedtuple("fraction", "ratio, denom")

%o for n in clist:

%o for i in range(1, n + 1):

%o ran = hn0 + (i * hn1)

%o rad = kn0 + (i * kn1)

%o try:

%o if D.copy_abs(app-D(ran)/D(rad)) < D.copy_abs(app-D(hn1)/D(kn1)):

%o conlist.append(fraction(f'{ran}/{rad}', rad))

%o except:

%o pass

%o hn2 = (n * hn1) + hn0

%o kn2 = (n * kn1) + kn0

%o conlist.append(fraction(f'{hn2}/{kn2}', kn2))

%o hn0, kn0 = hn1, kn1

%o hn1, kn1 = hn2, kn2

%o #Change x.denom to x.ratio for the full ratio as a string

%o finallist = [ x.denom for x in sorted(conlist, key=lambda i: i.denom) ]

%o return list(dict.fromkeys(finallist))

%o if __name__ == "__main__":

%o prec = 200

%o decimal.getcontext().prec = prec

%o value = D(6/5).ln()/D(2).ln()

%o vc = continued_fraction(value, prec)

%o print(', '.join([str(x) for x in best_rational_approximation(vc, value)]))

%Y Cf. A054540, A060525, A060526, A060527, A060528, A061918, A254351.

%K nonn,frac

%O 1,2

%A _Daniel Hoyt_, Oct 29 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 11:39 EDT 2024. Contains 371969 sequences. (Running on oeis4.)