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.

Showing 1-4 of 4 results.

A002965 Interleave denominators (A000129) and numerators (A001333) of convergents to sqrt(2).

Original entry on oeis.org

0, 1, 1, 1, 2, 3, 5, 7, 12, 17, 29, 41, 70, 99, 169, 239, 408, 577, 985, 1393, 2378, 3363, 5741, 8119, 13860, 19601, 33461, 47321, 80782, 114243, 195025, 275807, 470832, 665857, 1136689, 1607521, 2744210, 3880899, 6625109, 9369319, 15994428, 22619537
Offset: 0

Views

Author

Keywords

Comments

Denominators of Farey fraction approximations to sqrt(2). The fractions are 1/0, 0/1, 1/1, 2/1, 3/2, 4/3, 7/5, 10/7, 17/12, .... See A082766(n+2) or A119016 for the numerators. "Add" (meaning here to add the numerators and add the denominators, not to add the fractions) 1/0 to 1/1 to make the fraction bigger: 2/1. Now 2/1 is too big, so add 1/1 to make the fraction smaller: 3/2, 4/3. Now 4/3 is too small, so add 3/2 to make the fraction bigger: 7/5, 10/7, ... Because the continued fraction for sqrt(2) is all 2's, it will always take exactly two terms here to switch from a number that's bigger than sqrt(2) to one that's less. A097545/A097546 gives the similar sequence for Pi. A119014/A119015 gives the similar sequence for e. - Joshua Zucker, May 09 2006
The principal and intermediate convergents to 2^(1/2) begin with 1/1, 3/2 4/3, 7/5, 10/7; essentially, numerators=A143607, denominators=A002965. - Clark Kimberling, Aug 27 2008
(a(2n)*a(2n+1))^2 is a triangular square. - Hugh Darwen, Feb 23 2012
a(2n) are the interleaved values of m such that 2*m^2+1 and 2*m^2-1 are squares, respectively; a(2n+1) are the interleaved values of their corresponding integer square roots. - Richard R. Forberg, Aug 19 2013
Coefficients of (sqrt(2)+1)^n are a(2n)*sqrt(2)+a(2n+1). - John Molokach, Nov 29 2015
Apart from the first two terms, this is the sequence of denominators of the convergents of the continued fraction expansion sqrt(2) = 1/(1 - 1/(2 + 1/(1 - 1/(2 + 1/(1 - ....))))). - Peter Bala, Feb 02 2017
Limit_{n->infinity} a(2n+1)/a(2n) = sqrt(2); lim_{n->infinity} a(2n)/a(2n-1) = (2+sqrt(2))/2. - Ctibor O. Zizka, Oct 28 2018

Examples

			The convergents are rational numbers given by the recurrence relation p/q -> (p + 2*q)/(p + q). Starting with 1/1, the next three convergents are (1 + 2*1)/(1 + 1) = 3/2, (3 + 2*2)/(3 + 2) = 7/5, and (7 + 2*5)/(7 + 5) = 17/12. The sequence puts the denominator first, so a(2) through a(9) are 1, 1, 2, 3, 5, 7, 12, 17. - _Michael B. Porter_, Jul 18 2016
		

References

  • C. Brezinski, History of Continued Fractions and Padé Approximants. Springer-Verlag, Berlin, 1991, p. 24.
  • Jay Kappraff, Musical Proportions at the Basis of Systems of Architectural Proportion both Ancient and Modern, in Volume I of K. Williams and M.J. Ostwald (eds.), Architecture and Mathematics from Antiquity to the Future, DOI 10.1007/978-3-319-00143-2_27, Springer International Publishing Switzerland 2015. See Eq. 32.7.
  • Serge Lang, Introduction to Diophantine Approximations, Addison-Wesley, New York, 1966.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Guelena Strehler, Chess Fractal, April 2016, p. 24.

Crossrefs

Cf. A000129(n) = a(2n), A001333(n) = a(2n+1).

Programs

  • GAP
    a:=[0,1];; for n in [3..45] do a[n]:=a[n-1]+a[n-2-((n-1) mod 2)]; od; a; # Muniru A Asiru, Oct 28 2018
  • Haskell
    import Data.List (transpose)
    a002965 n = a002965_list !! n
    a002965_list = concat $ transpose [a000129_list, a001333_list]
    -- Reinhard Zumkeller, Jan 01 2014
    
  • JavaScript
    a=new Array(); a[0]=0; a[1]=1;
    for (i=2;i<50;i+=2) {a[i]=a[i-1]+a[i-2];a[i+1]=a[i]+a[i-2];}
    document.write(a); // Jon Perry, Sep 12 2012
    
  • Magma
    I:=[0,1,1,1]; [n le 4 select I[n] else 2*Self(n-2)+Self(n-4): n in [1..50]]; // Vincenzo Librandi, Nov 30 2015
    
  • Maple
    A002965 := proc(n) option remember; if n <= 0 then 0; elif n <= 3 then 1; else 2*A002965(n-2)+A002965(n-4); fi; end;
    A002965:=-(1+2*z+z**2+z**3)/(-1+2*z**2+z**4); # conjectured by Simon Plouffe in his 1992 dissertation; gives sequence except for two leading terms
  • Mathematica
    LinearRecurrence[{0, 2, 0, 1}, {0, 1, 1, 1}, 42] (* Vladimir Joseph Stephan Orlovsky, Feb 13 2012 *)
    With[{c=Convergents[Sqrt[2],20]},Join[{0,1},Riffle[Denominator[c], Numerator[c]]]] (* Harvey P. Dale, Oct 03 2012 *)
  • PARI
    a(n)=if(n<4,n>0,2*a(n-2)+a(n-4))
    
  • PARI
    x='x+O('x^100); concat(0, Vec((x+x^2-x^3)/(1-2*x^2-x^4))) \\ Altug Alkan, Dec 04 2015
    

Formula

a(n) = 2*a(n-2) + a(n-4) if n>3; a(0)=0, a(1)=a(2)=a(3)=1.
a(2*n) = a(2*n-1) + a(2*n-2) and a(2*n+1) = 2*a(2*n) - a(2*n-1).
G.f.: (x+x^2-x^3)/(1-2*x^2-x^4).
a(0)=0, a(1)=1, a(n) = a(n-1) + a(2*[(n-2)/2]). - Franklin T. Adams-Watters, Jan 31 2006
For n > 0, a(2*n) = a(2*n-1) + a(2*n-2) and a(2*n+1) = a(2*n) + a(2*n-2). - Jon Perry, Sep 12 2012
a(n) = (((sqrt(2) - 2)*(-1)^n + 2 + sqrt(2))*(1 + sqrt(2))^(floor(n/2)) - ((2 + sqrt(2))*(-1)^n -2 + sqrt(2))*(1 - sqrt(2))^(floor(n/2)))/8. - Ilya Gutkovskiy, Jul 18 2016
a(n) = a(n-1) + a(n-2-(n mod 2)); a(0)=0, a(1)=1. - Ctibor O. Zizka, Oct 28 2018

Extensions

Thanks to Michael Somos for several comments which improved this entry.

A119016 Numerators of "Farey fraction" approximations to sqrt(2).

Original entry on oeis.org

1, 0, 1, 2, 3, 4, 7, 10, 17, 24, 41, 58, 99, 140, 239, 338, 577, 816, 1393, 1970, 3363, 4756, 8119, 11482, 19601, 27720, 47321, 66922, 114243, 161564, 275807, 390050, 665857, 941664, 1607521, 2273378, 3880899, 5488420, 9369319, 13250218, 22619537, 31988856
Offset: 0

Views

Author

Joshua Zucker, May 08 2006

Keywords

Comments

"Add" (meaning here to add the numerators and add the denominators, not to add the fractions) 1/0 to 1/1 to make the fraction bigger: 2/1. Now 2/1 is too big, so add 1/1 to make the fraction smaller: 3/2, 4/3. Now 4/3 is too small, so add 3/2 to make the fraction bigger: 7/5, 10/7, ... Because the continued fraction for sqrt(2) is all 2s, it will always take exactly two terms here to switch from a number that's bigger than sqrt(2) to one that's less. a(n+2) = A082766(n).
a(2n) are the interleaved values of m such that 2*m^2-2 and 2*m^2+2 are squares, respectively; a(2n+1) are the corresponding integer square roots. - Richard R. Forberg, Aug 19 2013
Apart from the first two terms, this is the sequence of numerators of the convergents of the continued fraction expansion sqrt(2) = 1/(1 - 1/(2 + 1/(1 - 1/(2 + 1/(1 - ....))))). - Peter Bala, Feb 02 2017

Examples

			The fractions are 1/0, 0/1, 1/1, 2/1, 3/2, 4/3, 7/5, 10/7, 17/12, ...
		

Crossrefs

Cf. A097545, A097546 gives the similar sequence for Pi. A119014, A119015 gives the similar sequence for e. A002965 gives the denominators for this sequence. Also very closely related to A001333, A052542 and A000129.
See A082766 for another version.

Programs

  • Maple
    f:= gfun:-rectoproc({a(n+4)=2*a(n+2) +a(n),a(0)=1,a(1)=0,a(2)=1,a(3)=2}, a(n), remember):
    map(f, [$0..100]); # Robert Israel, Jun 10 2015
  • Mathematica
    f[x_, n_] := (m = Floor[x]; f0 = {m, m+1/2, m+1}; r = ({a___, b_, c_, d___} /; b < x < c) :> {b, (Numerator[b] + Numerator[c]) / (Denominator[b] + Denominator[c]), c}; Join[{m, m+1}, NestList[# /. r &, f0, n-3][[All, 2]]]); Join[{1, 0 }, f[Sqrt[2], 38]] // Numerator (* Jean-François Alcover, May 18 2011 *)
    LinearRecurrence[{0, 2, 0, 1}, {1, 0, 1, 2}, 40] (* and *) t = {1, 2}; Do[AppendTo[t, t[[-2]] + t[[-1]]]; AppendTo[t, t[[-3]] + t[[-1]]], {n, 30}]; t (* Vladimir Joseph Stephan Orlovsky, Feb 13 2012 *)
    a0 := LinearRecurrence[{2, 1}, {1, 1}, 20]; (*     A001333 *)
    a1 := LinearRecurrence[{2, 1}, {0, 2}, 20]; (* 2 * A000129 *)
    Flatten[MapIndexed[{a0[[#]],a1[[#]]} &, Range[20]]] (* Gerry Martens, Jun 09 2015 *)
  • PARI
    x='x+O('x^50); Vec((1 - x^2 + 2*x^3)/(1 - 2*x^2 - x^4)) \\ G. C. Greubel, Oct 20 2017

Formula

From Joerg Arndt, Feb 14 2012: (Start)
a(0) = 1, a(1) = 0, a(2n) = a(2n-1) + a(2n-2), a(2n+1) = a(2n) + a(2n-2).
G.f.: (1 - x^2 + 2*x^3)/(1 - 2*x^2 - x^4). (End)
a(n) = 1/4*(1-(-1)^n)*(-2+sqrt(2))*(1+sqrt(2))*((1-sqrt(2))^(1/2*(n-1))-(1+sqrt(2))^(1/2*(n-1)))+1/4*(1+(-1)^n)*((1-sqrt(2))^(n/2)+(1+sqrt(2))^(n/2)). - Gerry Martens, Nov 04 2012
a(2n) = A001333(n). a(2n+1) = A052542(n) for n>0. - R. J. Mathar, Feb 05 2024

A143607 Numerators of principal and intermediate convergents to 2^(1/2).

Original entry on oeis.org

1, 3, 4, 7, 10, 17, 24, 41, 58, 99, 140, 239, 338, 577, 816, 1393, 1970, 3363, 4756, 8119, 11482, 19601, 27720, 47321, 66922, 114243, 161564, 275807, 390050, 665857, 941664, 1607521, 2273378, 3880899, 5488420, 9369319, 13250218, 22619537, 31988856, 54608393
Offset: 1

Views

Author

Clark Kimberling, Aug 27 2008

Keywords

Comments

Sequence is essentially A082766 (by omitting two terms A082766(0) and A082766(2)). - L. Edson Jeffery, Apr 04 2011
a(n) = A119016(n+2) for n>=2. - Georg Fischer, Oct 07 2018

Examples

			The principal and intermediate convergents to 2^(1/2) begin with 1/1, 3/2 4/3, 7/5, 10/7, ...
		

References

  • Serge Lang, Introduction to Diophantine Approximations, Addison-Wesley, New York, 1966.

Crossrefs

Cf. A002965 (denominators), A082766, A119016.

Programs

  • GAP
    a:=[1,3,4,7,10];; for n in [6..40] do a[n]:=2*a[n-2]+a[n-4]; od; a; # Muniru A Asiru, Oct 07 2018
  • Maple
    seq(coeff(series(x*(1+x)*(1+2*x+x^3)/(1-2*x^2-x^4),x,n+1), x, n), n = 1 .. 40); # Muniru A Asiru, Oct 07 2018
  • Mathematica
    CoefficientList[Series[(1 + x)*(1 + 2*x + x^3) / (1 - 2*x^2 - x^4), {x, 0, 50}], x] (* or *)
    LinearRecurrence[{0, 2, 0, 1}, {1, 3, 4, 7, 10}, 40] (* Stefano Spezia, Oct 08 2018; signature amended by Georg Fischer, Apr 02 2019 *)
  • PARI
    Vec(x*(1 + x)*(1 + 2*x + x^3) / (1 - 2*x^2 - x^4) + O(x^60)) \\ Colin Barker, Jul 28 2017
    

Formula

From Colin Barker, Jul 28 2017: (Start)
G.f.: x*(1 + x)*(1 + 2*x + x^3) / (1 - 2*x^2 - x^4).
a(n) = 2*a(n-2) + a(n-4) for n>5.
(End)

A098894 Values of k such that {s(1),...,s(k)} is a palindrome, where {s(1),s(2),...} is the fixed point of the substitutions 0->1 and 1->110.

Original entry on oeis.org

1, 2, 5, 8, 15, 22, 39, 56, 97, 138, 237, 336, 575, 814, 1391, 1968, 3361, 4754, 8117, 11480, 19599, 27718, 47319, 66920, 114241, 161562, 275805, 390048, 665855, 941662, 1607519, 2273376, 3880897, 5488418, 9369317
Offset: 1

Views

Author

John W. Layman, Nov 04 2004

Keywords

Comments

Superseeker suggests: (1) o.g.f. (1+x+x^2+x^3)/(1+2x-2x^2-x^3+x^4+x^5), (2) terms of odd index {1,5,15,39,...} give A034182 and (3) {a(n)+2} gives A082766, except for several initial terms.
Conjecture: partial sums of A152113. - Sean A. Irvine, Jul 14 2022

Examples

			Start with 1 and iterate the substitutions 0->1, 1->110 to get 1, 110, 1101101, 11011011101101110, 11011011101101110110110111011011101101101,... The initial terms from the beginning to the single quotes form palindromes: 1'1'011'011'1011011'1011011',..., of lengths 1,2,5,8,15,22,...
		

Crossrefs

Showing 1-4 of 4 results.