A204689 a(n) = n^n (mod 4).
1, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,1).
Programs
-
Magma
[1] cat &cat [[1, 0, 3, 0]^^30]; // Wesley Ivan Hurt, Jun 15 2016
-
Maple
A204689:=n->n^n mod 4: seq(A204689(n), n=0..150); # Wesley Ivan Hurt, Jun 15 2016
-
Mathematica
Table[PowerMod[n, n, 4], {n,0,140}]
Formula
From Bruno Berselli, Jan 18 2012: (Start)
G.f.: (1+x+3x^3-x^4)/(1-x^4).
a(n) = (1-(-1)^n)*(2+i^(n+1))/2 with i=sqrt(-1), a(0)=1.
a(n) = A109718(n) for n>0. (End)
Comments