A070352 a(n) = 3^n mod 5; or period 4, repeat [1, 3, 4, 2].
1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1
Offset: 0
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).
Crossrefs
Cf. A000032. - Clark Kimberling, Aug 28 2008
Programs
-
Magma
&cat [[1, 3, 4, 2]^^27]; // Bruno Berselli, Dec 10 2015
-
Magma
[Modexp(3, n, 5): n in [0..100]]; // Bruno Berselli, Mar 23 2016
-
Maple
seq(op([1, 3, 4, 2]), n=0..50); # Wesley Ivan Hurt, Jul 09 2016
-
Mathematica
Table[PowerMod[3, n, 5], {n, 0, 200}] (* Vladimir Joseph Stephan Orlovsky, Jun 10 2011 *)
-
PARI
a(n) = lift(Mod(3, 5)^n); \\ Michel Marcus, Mar 16 2016
-
Sage
[power_mod(2,-n,5) for n in range(0, 101)] # Zerinvary Lajos, Jun 08 2009
Formula
From R. J. Mathar, Apr 13 2010: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3) for n>2.
G.f.: (1+2*x+2*x^2) / ((1-x)*(1+x^2)). (End)
a(n) = 2^(3*n) mod 5. - Gary Detlefs, May 18 2014
E.g.f.: (1/2)*(5*exp(x) + sin(x) - 3*cos(x)). - G. C. Greubel, Mar 11 2016
a(n) = a(n-4) for n>3. - Wesley Ivan Hurt, Jul 09 2016
Comments