OFFSET
0,2
COMMENTS
Period 4: repeat [1, 5, 12, 8].
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,-1,1).
FORMULA
From R. J. Mathar, Apr 20 2010: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3) for n>2.
G.f.: ( 1+4*x+8*x^2 ) / ( (1-x)*(1+x^2) ). (End)
a(n) = (26-(11+3*I)*(-I)^n-(11-3*I)*I^n)/4. - Bruno Berselli, Feb 07 2011
From G. C. Greubel, Mar 05 2016: (Start)
a(n) = a(n-4) for n>3.
E.g.f.: (1/2)*(13*cosh(x) + 13*sinh(x) - 11*cos(x) - 3*sin(x)). (End)
MAPLE
seq(op([1, 5, 12, 8]), n=0..50); # Wesley Ivan Hurt, Jul 06 2016
MATHEMATICA
Table[Mod[5^n, 13], {n, 0, 100}] (* G. C. Greubel, Mar 05 2016 *)
PowerMod[5, Range[0, 100], 13] (* or *) PadRight[{}, 100, {1, 5, 12, 8}] (* Harvey P. Dale, Jul 03 2019 *)
PROG
(Sage) [power_mod(5, n, 13) for n in range(0, 93)] # Zerinvary Lajos, Nov 25 2009
(PARI) a(n)=lift(Mod(5, 13)^n) \\ Charles R Greathouse IV, Mar 22 2016
(Magma) [Modexp(5, n, 13): n in [0..100]]; // Vincenzo Librandi, Jun 29 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, May 12 2002
STATUS
approved