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.

A178783 Continued fraction for Euler-Mascheroni constant with convergents 0/1, 1/1, 1/2, 4/7, etc., which lie between the monotonically increasing series given by (Sum_{k=1..n} 1/k - Sum_{k=n..n^2} 1/k) and the monotonically decreasing series (Sum_{k=1..n} 1/k - Sum_{k=n..n^2-1} 1/k), both of which converge to gamma. Thus each p/q in the sequence lies within 1/q^2 of gamma.

Original entry on oeis.org

0, 1, 1, 3, -4, -5, 3, 13, 5, 2, -10, -3, 4, 2, -42, -12, 3, 8, -9, -2, 6, -50, 5, -67, -5, 7, 12, -401, -2, -2, 3, 3, -4, -6, 3, 3, -12, -3, -2, 2, 2, -5, -6
Offset: 0

Views

Author

Joseph G. Johnson (jjohnson1253(AT)hotmail.com), Jun 12 2010

Keywords

Comments

Series derived from def. gamma = lim(Sum_{k=1..n} 1/k - log(n)) by noting that 2*gamma = 2*Sum_{k=1..n} 1/k - 2*log(n) (ignoring limit) and also gamma = Sum_{k=1..n^2} 1/k - log(n^2), then gamma = 2*gamma - gamma gets rid of the log term and the series consists of all rational terms. The decreasing series was found by accident. The proofs for both are straightforward. The PARI program uses the first term of the Euler-Maclaurin summation and gamma itself for the upper and lower bounds.

Crossrefs

Cf. A002852.

Programs

  • PARI
    pconv=vector(43); qconv=vector(43); cf=vector(43); fract=vector(43); pconv[1]=0; pconv[2]=1; pconv[3]=1; pconv[4]=4; qconv[1]=1; qconv[2]=1; qconv[3]=2; qconv[4]=7; cf[1]=0; cf[2]=1; cf[3]=1; cf[4]=3; fract[1]=0/1; fract[2]=1/1; fract[3]=1/2; fract[4]=4/7; for(k=5,43, tst=0; cfm=1; until(tst==1, pp = cfm * pconv[k - 1] + pconv[k - 2]; pn = cfm * pconv[k - 1] - pconv[k - 2]; qp = cfm * qconv[k - 1] + qconv[k - 2]; qn = cfm * qconv[k - 1] - qconv[k - 2]; slp = pp/qp; sln = pn/qn; if(((Euler - slp < 2/(3 * qp^2) && Euler - slp > 0) ||
    (slp - Euler < 1/(3 * qp^2) && slp - Euler > 0)) || ((Euler - sln < 2/(3 * qn^2) && Euler - sln > 0) || (sln - Euler < 1/(3 * qn^2) && sln - Euler > 0)), pconv[k] = ((Euler - slp < 2/(3 * qp^2) && Euler - slp > 0) || (slp - Euler < 1/(3 * qp^2) && slp - Euler > 0))*pp + ((Euler - sln < 2/(3 * qn^2) && Euler - sln > 0) || (sln - Euler < 1/(3 * qn^2) && sln - Euler > 0))*pn; qconv[k] = ((Euler - slp < 2/(3 * qp^2) && Euler - slp > 0) ||
    (slp - Euler < 1/(3 * qp^2) && slp - Euler > 0))*qp + ((Euler - sln < 2/(3 * qn^2) && Euler - sln > 0) || (sln - Euler < 1/(3 * qn^2) && sln - Euler > 0))*qn; fract[k] = pconv[k]/qconv[k]; cf[k] = ((Euler - slp < 2/(3 * qp^2) && Euler - slp > 0) || (slp - Euler < 1/(3 * qp^2) && slp - Euler > 0))*cfm - ((Euler - sln < 2/(3 * qn^2) && Euler - sln > 0) || (sln - Euler < 1/(3 * qn^2) && sln - Euler > 0))*cfm; tst = 1, cfm = cfm + 1)); write("eulwritefile.txt","Convergents: ",fract); write("eulwritefile.txt","continued fraction: ",cf); write("eulwritefile.txt","sln: ",sln); write("eulwritefile.txt","slp: ",slp))