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.

A157810 Period 4: repeat [2, 1, 3, 2].

Original entry on oeis.org

2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 1, 3, 2
Offset: 1

Views

Author

Jonathan Vos Post, Mar 07 2009

Keywords

Comments

Continued fraction expansion of (7+sqrt(93))/6. - Klaus Brockhaus, Apr 30 2010

Crossrefs

Cf. A001220.

Programs

  • Magma
    [2 - (-1)^n/2 + (-1)^Ceiling(n/2)/2 : n in [1..100]]; // Wesley Ivan Hurt, Jun 23 2014
  • Maple
    A157810:=n->2 - (-1)^n/2 + (-1)^ceil(n/2)/2; seq(A157810(n), n=1..100); # Wesley Ivan Hurt, Jun 23 2014
  • Mathematica
    ContinuedFraction[(7+Sqrt[93])/6,100] (* Harvey P. Dale, Jun 28 2012 *)
    CoefficientList[Series[-(2*x^3 + 3*x^2 + x + 2)/((x - 1)*(x + 1)*(x^2 + 1)), {x, 0, 60}], x] (* Wesley Ivan Hurt, Jun 22 2014 *)
  • PARI
    Vec(-x*(2*x^3+3*x^2+x+2)/((x-1)*(x+1)*(x^2+1)) + O(x^100)) \\ Colin Barker, Jun 20 2014
    

Formula

a(n) = a(n-4) for n>4. G.f.: x*(2*x^3+3*x^2+x+2) / ((1-x)*(x+1)*(x^2+1)). - Colin Barker, Jun 20 2014
a(n) = 2-(-1)^n/2+(-1)^ceiling(n/2)/2. - Wesley Ivan Hurt, Jun 23 2014
a(n) = (4 + cos(n*Pi/2) - cos(n*Pi) - sin(n*Pi/2) - I*sin(n*Pi))/2.

Extensions

Simpler definition from Wesley Ivan Hurt, Jul 07 2014