A130848 Periodic sequence with period (2, 5, 3, -2, -5, -3).
2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3, 2, 5, 3, -2, -5, -3
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (1,-1).
Programs
-
Magma
m:=105; [ [2, 5, 3, -2, -5, -3][ (n-1) mod 6 + 1 ]: n in [1..m] ]; /* Klaus Brockhaus, Jul 30 2007 */
-
Mathematica
LinearRecurrence[{1,-1},{2,5},120] (* or *) PadRight[{},120,{2,5,3,-2,-5,-3}] (* Harvey P. Dale, Dec 27 2022 *)
-
PARI
{m=104; a=2; b=5; print1(a=2, ",", b=5, ","); for(n=2, m, print1(c=b-a, ","); a=b; b=c)} /* Klaus Brockhaus, Jul 30 2007 */
Formula
For n > 1, a(n) = a(n-1) - a(n-2).
a(n) = a(n-6).
G.f.: (2+3*x)/(1-x+x^2).
a(n) = 2*cos(Pi*n/3) + (8/3)*3^(1/2)*sin(Pi*n/3). - R. J. Mathar, Nov 15 2007
Extensions
Edited by Klaus Brockhaus, Jul 30 2007
Comments