A109718 Periodic sequence with period {0,1,0,3}, or n^3 mod 4.
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, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,1).
Crossrefs
Programs
-
Magma
&cat[[0,1,0,3]: k in [0..26]]; // Bruno Berselli, Mar 14 2011
-
PARI
a(n)=n^3%4 \\ Charles R Greathouse IV, Apr 06 2016
-
Sage
[power_mod(n,3,4 )for n in range(0, 105)] # Zerinvary Lajos, Oct 29 2009
Formula
a(n) = n^3 mod 4.
G.f. = (x+3*x^3)/(1-x^4).
a(n) = (n mod 2)*(n mod 4) = (1+(-1)^(n+1))*(2+i^(n+1))/2 with i=sqrt(-1). - Bruno Berselli, Mar 14 2011
Comments