A157810 Period 4: repeat [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, 2, 1, 3, 2
Offset: 1
Links
- Vesselin Dimitrov, Problem S07 - 4 (Corrected). Harvard College Mathematical Review, Vol. 1, No. 2, Fall 2007.
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,1).
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
Comments