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-7 of 7 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.

A228405 Pellian Array, A(n, k) with numbers m such that 2*m^2 +- 2^k is a square, and their corresponding square roots, read downward by diagonals.

Original entry on oeis.org

0, 1, 1, 0, 1, 2, 2, 2, 3, 5, 0, 2, 4, 7, 12, 4, 4, 6, 10, 17, 29, 0, 4, 8, 14, 24, 41, 70, 8, 8, 12, 20, 34, 58, 99, 169, 0, 8, 16, 28, 48, 82, 140, 239, 408, 16, 16, 24, 40, 68, 116, 198, 338, 577, 985, 0, 16, 32, 56, 96, 164, 280, 478, 816, 1393, 2378
Offset: 0

Views

Author

Richard R. Forberg, Aug 21 2013

Keywords

Comments

The left column, A(n,0), is A000129(n), Pell Numbers.
The top row, A(0,k), is A077957(k) plus an initial 0, which is the inverse binomial transform of A000129.
These may be considered initializing values, or results, depending the perspective taken, since there are several ways to generate the array. See Formula section for details.
The columns of the array hold all values, in sequential order, of numbers m such that 2m^2 + 2^k or 2m^2 - 2^k are squares, and their corresponding square roots in the next column, which then form the "next round" of m values for k+1.
For example A(n,0) are numbers such that 2m^2 +- 1 are squares, the integer square roots of each are in A(n,1), which are then numbers m such that 2m^2 +- 2 are squares, with those square roots in A(n,2), etc.
A(n, k)/A(n,k-2) = 2; A(n,k)/A(n,k-1) converges to sqrt(2) for large n.
A(n,k)/A(n-1,k) converges to 1 + sqrt(2) for large n.
The other columns of this array hold current OEIS sequences as follows:
A(n,1) = A001333(n); A(n,2) = A163271(n); A(n,3) = A002203(n);
Bisections of these column-oriented sequences also appear in the OEIS, corresponding to the even and odd rows of the array, which in turn correspond to the two different recursive square root equations in the formula section below.
Farey fraction denominators interleave columns 0 and 1, and the corresponding numerators interleave columns 1 and 2, for approximating sqrt(2). See A002965 and A119016, respectively.
The other rows of this array hold current OEIS sequences as follows:
A(1,k) = A016116(k); A(2,k) = A029744(k) less the initial 1;
A(3,k) = A070875(k); A(4,k) = A091523(k) less the initial 8.
The Pell Numbers (A000219) are the only initializing set of numbers where the two recursive square root equations (see below) produce exclusively integer values, for all iterations of k. For any other initial values only even iterations (at k = 2, 4, ...) produce integers.
The numbers in this array, especially the first three columns, are also integer square roots of these expressions: floor(m^2/2), floor(m^2/2 + 1), floor (m^2/2 - 1). See A227972 for specific arrangements and relationships. Also: ceiling(m^2/2), ceiling(m^2/2 + 1), ceiling (m^2/2 -1), m^2+1, m^2-1, m^2*(m^2-1)/2, m^2*(m^2-1)/2, in various different arrangements. Many of these involve: A000129(2n)/2 = A001109(n).
A001109 also appears when multiplying adjacent columns: A(n,k) * A(n,k+1) = (k+1) * A001109(n), for all k.

Examples

			With row # as n. and column # as k, and n, k =>0, the array begins:
0,     1,     0,     2,     0,     4,     0,     8, ...
1,     1,     2,     2,     4,     4,     8,     8, ...
2,     3,     4,     6,     8,    12,    16,    24, ...
5,     7,    10,    14,    20,    28,    40,    56, ...
12,   17,    24,    34,    48,    68,    96,   136, ...
29,   41,    58,    82,   116,   164,   232,   328, ...
70,   99,   140,   198,   280,   396,   560,   792, ...
169,  239,  338,   478,   676,   956,  1352,  1912, ...
408,  577,  816,  1154,  1632,  2308,  3264,  4616, ...
		

Crossrefs

Formula

If using the left column and top row to initialize: A(n,k) = A(n,k-1) + A(n-1,k-1).
If using only the top row to initialize, then each column for k = i is the binomial transform of A(0,k) restricted to k=> i as input to the transform with an appropriate down shift of index. The inverse binomial transform with a similar condition can produce each row from A000129.
If using only the first two rows to initialize then the Pell equation produces each column, as: A(n,k) = 2*A(n-1, k) + A(n-2, k).
If using only the left column (A000219(n) = Pell Numbers) to initialize then the following two equations will produce each row:
A(n,k) = sqrt(2*A(n,k-1) + (-2)^(k-1)) for even rows
A(n,k) = sqrt(2*A(n,k-1) - (-2)^(k-1)) for odd rows.
Interestingly, any portion of the array can also be filled "backwards" given the top row and any column k, using only: A(n,k-1) = A(n-1,k-1) + A(n-1, k), or if given any column and its column number by rearranging the sqrt recursions above.

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)

A082766 Series ratios converge alternately to sqrt(2) and 1+sqrt(1/2).

Original entry on oeis.org

1, 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
Offset: 1

Views

Author

Gary W. Adamson, May 24 2003

Keywords

Comments

a(2n+2)/a(2n+1) converges to sqrt(2).
a(2n+1)/a(2n) converges to 1+sqrt(1/2).
a(n+2)/a(n) converges to 1+sqrt(2).
a(2n) is A001333, a(2n+1) is A052542.

Crossrefs

Cf. A001333, A052542. See A119016 for another version.

Programs

  • Haskell
    import Data.List (transpose)
    a082766 n = a082766_list !! (n-1)
    a082766_list = concat $ transpose [a052542_list, tail a001333_list]
    -- Reinhard Zumkeller, Feb 24 2015
    
  • Mathematica
    Rest[CoefficientList[Series[x (1 - x^2 + x) (x^2 + 1)/(1 - 2 x^2 - x^4), {x, 0, 50}], x]] (* G. C. Greubel, Nov 28 2017 *)
    LinearRecurrence[{0,2,0,1},{1,1,2,3,4},50] (* Harvey P. Dale, Dec 15 2022 *)
  • PARI
    x='x+O('x^30); Vec(x*(1+x-x^2)*(x^2+1)/(1-2*x^2-x^4)) \\ G. C. Greubel, Nov 28 2017

Formula

a(2n) = a(2n-1) + a(2n-2); a(2n+1) = a(2n) + a(2n-2)
O.g.f.: x*(1+x-x^2)*(x^2+1)/(1-2*x^2-x^4). - R. J. Mathar, Aug 08 2008

Extensions

Edited by Don Reble, Nov 04 2005

A142879 a(n) = 5*a(n-3) - a(n-6) with terms 1..6 as 0, 1, 2, 5, 7, 9.

Original entry on oeis.org

0, 1, 2, 5, 7, 9, 25, 34, 43, 120, 163, 206, 575, 781, 987, 2755, 3742, 4729, 13200, 17929, 22658, 63245, 85903, 108561, 303025, 411586, 520147, 1451880, 1972027, 2492174, 6956375, 9448549, 11940723, 33329995, 45270718, 57211441, 159693600
Offset: 1

Views

Author

Roger L. Bagula and Gary W. Adamson, Sep 28 2008

Keywords

Crossrefs

Programs

  • Mathematica
    Clear[a, n]; a[0] = 0; a[1] = 1; a[n_] := a[n] = If[Mod[n, 3] == 0, 2*a[n - 1] + a[n - 2], If[Mod[n, 3] == 1, a[n - 1] + a[n - 2], 2*a[n - 1] - a[n - 2]]]; b = Table[a[n], {n, 0, 50}]
    LinearRecurrence[{0,0,5,0,0,-1},{0,1,2,5,7,9},40] (* Harvey P. Dale, Apr 06 2016 *)
  • PARI
    a=vector(20); a[1]=1; a[2]=2; for(n=3, #a, if(n%3==0, a[n]=2*a[n-1]+a[n-2], if(n%3==1, a[n]=a[n-1]+a[n-2], a[n]=2*a[n-1]-a[n-2]))); concat(0, a) \\ Colin Barker, Jan 30 2016
    
  • PARI
    concat(0, Vec(x^2*(1+2*x+5*x^2+2*x^3-x^4)/(1-5*x^3+x^6) + O(x^50))) \\ Colin Barker, Jan 30 2016

Formula

a(n) = 2*a(n - 1) + a(n - 2) if 3 | n, a(n) = a(n - 1) + a(n - 2) if n = 1 mod 3, and a(n) = 2*a(n - 1) - a(n - 2) if n = 2 mod 3.
G.f.: x^2*(1+2*x+5*x^2+2*x^3-x^4) / (1-5*x^3+x^6). - Colin Barker, Jan 08 2013

Extensions

New name from Colin Barker and Charles R Greathouse IV, Jan 08 2013

A142881 a(0) = 0, a(1) = 1, after which, if n=3k: a(n) = 2*a(n-1) - a(n-2), if n=3k+1: a(n) = a(n-1) + a(n-2), if n=3k+2: a(n) = 2*a(n-1) + a(n-2).

Original entry on oeis.org

0, 1, 2, 3, 5, 13, 21, 34, 89, 144, 233, 610, 987, 1597, 4181, 6765, 10946, 28657, 46368, 75025, 196418, 317811, 514229, 1346269, 2178309, 3524578, 9227465, 14930352, 24157817, 63245986, 102334155, 165580141, 433494437, 701408733, 1134903170
Offset: 0

Views

Author

Roger L. Bagula and Gary W. Adamson, Sep 28 2008

Keywords

Comments

The original name of the sequence was: A modulo three switched recursion (third kind): a(n)=If[Mod[n, 3] ==2, 2*a(n - 1) + a(n - 2), If[Mod[n, 3] == 1, a(n - 1) + a(n - 2), 2*a(n - 1) - a(n - 2)]].
How is this related to A000045 ? - Antti Karttunen, Jan 29 2016

Crossrefs

Programs

  • Mathematica
    Clear[a, n]; a[0] = 0; a[1] = 1; a[n_] := a[n] = If[Mod[n, 3] == 2, 2*a[n - 1] + a[n - 2], If[Mod[n, 3] == 1, a[n - 1] + a[n - 2], 2*a[n - 1] - a[n - 2]]]; b = Table[a[n], {n, 0, 50}]
  • PARI
    a=vector(100); a[1]=1; a[2]=2; for(n=3, #a, if(n%3==0, a[n]=2*a[n-1]-a[n-2], if(n%3==1, a[n]=a[n-1]+a[n-2], a[n]=2*a[n-1]+a[n-2]))); concat(0, a) \\ Colin Barker, Jan 30 2016

Formula

a(n) = If[Mod[n, 3] == 2, 2*a(n - 1) + a(n - 2), If[Mod[n, 3] == 1, a(n - 1) + a(n - 2), 2*a(n - 1) - a(n - 2)]].
a(n) = 7*a(n-3)-a(n-6). G.f.: -x^2*(x^4+2*x^3-3*x^2-2*x-1) / (x^6-7*x^3+1). [Colin Barker, Jan 08 2013]
a(0) = 0, a(1) = 1, after which, if n is a multiple of 3, a(n) = 2*a(n-1) - a(n-2), else, if n is of the form 3k+1, a(n) = a(n-1) + a(n-2), and otherwise [when n is of the form 3k+2], a(n) = 2*a(n-1) + a(n-2). - Antti Karttunen, Jan 29 2016, after the original name of the sequence.

Extensions

Offset corrected and sequence edited by Antti Karttunen, Jan 29 2016

A142880 a(n) = 7*a(n-3) - a(n-6).

Original entry on oeis.org

0, 1, 2, 3, 8, 13, 21, 55, 89, 144, 377, 610, 987, 2584, 4181, 6765, 17711, 28657, 46368, 121393, 196418, 317811, 832040, 1346269, 2178309, 5702887, 9227465, 14930352, 39088169, 63245986, 102334155, 267914296, 433494437, 701408733, 1836311903
Offset: 0

Views

Author

Roger L. Bagula and Gary W. Adamson, Sep 28 2008

Keywords

Crossrefs

Programs

  • Mathematica
    a[0] = 0; a[1] = 1;
    a[n_] := a[n] = If[Mod[n, 3] == 1, 2*a[n - 1] + a[n - 2], If[Mod[n, 3] == 0, a[n - 1] + a[n - 2], 2*a[n - 1] - a[n - 2]]];
    Table[a[n], {n, 0, 50}]
    LinearRecurrence[{0,0,7,0,0,-1},{0,1,2,3,8,13},40] (* Harvey P. Dale, Jul 17 2021 *)

Formula

G.f.: -x*(1+x)*(x^3 - 2*x^2 - x - 1) / ( 1 - 7*x^3 + x^6 ).
a(3n) = A033888(n).
a(3n+1) = A033890(n).
a(3n+2)= A033891(n).
a(n) = 2*a(n-1) + a(n-2) if n == 1 (mod 3).
a(n) = a(n-1) + a(n-2) if n == 0 (mod 3).
a(n) = 2*a(n-1) - a(n-2) if n == 2 (mod 3).
Showing 1-7 of 7 results.