[seqfan] Re: OEIS mentioned in What's Special About This Fraction?

M. F. Hasler oeis at hasler.fr
Tue Dec 8 19:51:20 CET 2020


On Mon, 7 Dec 2020, 23:20 Neil Sloane, <njasloane at gmail.com> wrote:

> The Index to Fractions in the OEIS on the OEIS wiki does that:  it should
> the fractions written as fractions


Well, just to be clear, by "displayed as fractions" I didn't mean Axxx/Ayyy
but
a(1)/b(1), a(2)/b(2), a(3)/b(3), ... with the actual numbers.
It would be easy with "extended keywords" (cf. OEIS wiki link on my
previous mail):
the keyword "frac:Ayyy" could be displayed as a link or button executing a
JavaScript (approximately):

var Ayyy=getSection(this,"keywords").innerText.pregReplace(
/.*frac:(A[0-9]+).*/, '\1' );
getSection(this,"data").innerHTML += "<br/>as fractions with denominator
"+Ayyy+": " + makeFrac( getSection(this,"data").innerText,getSeqData( Ayyy
));

function getSection(t,n){return t.parentNode.getElementByName(n)}
function getSeqData( n ){ var s=""; for(var r of getFile("https://oeis.org/
"+n+"/internal"))
 switch( r.substr(0,2)) case '%S': case '%T': case '%U': s +=
r.substr(3)+",";
 return s}
function makeFrac(a,b) { var s="",A=a.split(','), B=b.split(','); for(var
i=0; i<min( A.length, B.length); ++i) s+=A[i]+"/"+B[i]+","; return s}

That's all it needs (up to slightly approximative syntax / functions
pregReplace, getFile and parentNode (due to ill-structured HTML)).
One could simply print the list of a(n)/b(n) as above, or also print the
list of b(n)/a(n), or use the 2nd arg to the frac keyword
(with extended syntax: frac[:Ayyy[:{n|d}]]) to know whether the other
sequence represents numerators or denominators.
but since a link to the other seq. is given, just use is as denominators as
above and the reader can click on the A-number to get the reciprocal
fractions.)

I will add this ASAP to my https://github.com/m-f-h/OEIS.js which already
demonstrates similar very easily implemented interactive client-side
functionality for LREC sequences (automatic extension of DATA and
generation of PROGRAMs).

- Maximilian

On Mon, Dec 7, 2020 at 9:28 PM Alonso Del Arte <alonso.delarte at gmail.com>
> wrote:
> > > (these numerators and denominators are certainly in OEIS... but it
> would
> > be nice to have a direct link for the "frac" sequences to be displayed as
> > fractions.
> >
> > I agree 100%. But I know next to nothing about the OEIS behind the scenes
> > to say how feasible this was back then or is now.
> >
> > Al
> >
> > On Mon, Dec 7, 2020 at 4:00 PM M. F. Hasler <oeis at hasler.fr> wrote:
> >
> > > Pierre wrote:
> > >
> > > >   On Friday, December 4, 2020 3:53:45 PM EST Alonso Del Arte wrote:
> > > > > I've started What's Special About This Fraction?
> > > > > https://alonso-del-arte.github.io/misc-info/math/fractions.html
> > > > > The page is a little bare right now, ... There are probably other
> > OEIS
> > > > > entries that I should mention in that page.
> > > > A few more rational approximations:
> > > > 71/41 is an approximation to √3
> > > > 41/29 is an approximation to √2 (and produces diagonal stripes in
> > Halton,
> > >
> > >
> > > Anyway we have the rational approximations of irrationals from the
> > > continued fraction expansions:
> > > (PARI) cf(x)=[c[1]/c[2] | c <- contfracpnqn(contfrac(x),9)]
> > >
> > > cf(sqrt(2)) :
> > > [1/1 ; 3 / 2 ; 7 / 5 ; 17 / 12 ; 41 / 29 ; 99 / 70 ; 239 / 169 ; 577 /
> > 408
> > > 1393 / 985 ; 3363 / 2378 ]
> > > cf(sqrt(3))
> > >  [1, 2, 5/3, 7/4, 19/11, 26/15, 71/41, 97/56, 265/153, 362/209]
> > >  cf(sqrt(5))
> > >  [2, 9/4, 38/17, 161/72, 682/305, 2889/1292, 12238/5473, 51841/23184,
> > > 219602/98209, 930249/416020]
> > >  cf(Pi)
> > >  [3, 22/7, 333/106, 355/113, 103993/33102, 104348/33215, 208341/66317,
> > > 312689/99532, 833719/265381, 1146408/364913]
> > >  cf(exp(1))
> > >  [2, 3, 8/3, 11/4, 19/7, 87/32, 106/39, 193/71, 1264/465, 1457/536]
> > >  cf(Euler) \\ i.e., gamma
> > >  [0, 1, 1/2, 3/5, 4/7, 11/19, 15/26, 71/123, 228/395, 3035/5258]
> > >  cf((sqrt(5)-1)/2) \\ golden ratio phi = 1/Phi = Phi - 1
> > >  [0, 1, 1/2, 2/3, 3/5, 5/8, 8/13, 13/21, 21/34, 34/55]
> > >  cf(sqrt(Pi))
> > >  [1, 2, 7/4, 16/9, 23/13, 39/22, 257/145, 296/167, 8545/4821,
> > 111381/62840]
> > >  cf(sqrt(exp(1)))
> > >  [1, 2, 3/2, 5/3, 28/17, 33/20, 61/37, 582/353, 643/390, 1225/743]
> > >  cf(sqrt(Euler))
> > >  [0, 1, 3/4, 19/25, 117/154, 604/795, 721/949, 217625/286444,
> > > 435971/573837, 10680929/14058532]
> > > etc.
> > > (these numerators and denominators are certainly in OEIS... but it
> would
> > be
> > > nice to have a direct link for the "frac" sequences to be displayed as
> > > fractions. I suggested a mechanism for that several years ago, see
> > >
> > >
> >
> https://oeis.org/wiki/User:M._F._Hasler/Work_in_progress/Improvements_of_OEIS#I._Keywords_with_parameters
> > > .)
> > >
> > > Is it remarkable that the fractions of Pi grow the fastest (among these
> > > "random samples")...?
> > > For the golden ratio Phi it is not surprising the fractions are the
> > > smallest, it's known that this is the "most irrational number" with
> > > contfrac 1+1/(1+1/(1+1/(1+...))).
> > >
> > > - Maximilian
> > >
> > >  therefore 71/29 is an approximation to √6
> > > > 99/70 is an approximation to √2
> > > >
> > > > Pierre



More information about the SeqFan mailing list