OFFSET
0,3
COMMENTS
Multiplicative with a(2) = 4, a(2^e) = 0 if e >= 2, a(p^e) = 1 otherwise. - David W. Wilson, Jun 12 2005
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,0,0,1). - R. J. Mathar, Apr 20 2010
FORMULA
From R. J. Mathar, Apr 20 2010: (Start)
a(n) = a(n-4) for n > 3.
G.f.: -x*(1+4*x+x^2) / ( (x-1)*(1+x)*(x^2+1) ). (End)
Dirichlet g.f.: zeta(s)*(1 + 4*2^(-s))*(1 - 2^(-s)). - R. J. Mathar, Mar 10 2011
a(n) = (n mod 2) + 4*floor(((n+1) mod 4)/3). - Gary Detlefs, Dec 29 2011
From Wesley Ivan Hurt, Mar 19 2015: (Start)
a(n) = (((n+1) mod 4) - 1)^2.
a(n) = (1 + (-1)^n - 2(-1)^((2n + 1 - (-1)^n)/4))^2/4. (End)
E.g.f.: 2*cosh(x) + sinh(x) - 2*cos(x). - G. C. Greubel, Mar 22 2016
a(n) = (3 + cos(n*Pi) - 4*cos(n*Pi/2))/2. - Wesley Ivan Hurt, Dec 21 2016
a(n) = a(-n) for all n in Z. - Michael Somos, Dec 22 2016
EXAMPLE
G.f. = x + 4*x^2 + x^3 + x^5 + 4*x^6 + x^7 + x^9 + 4*x^10 + x^11 + x^13 + ...
MAPLE
seq(n mod 2 + 4*floor(((n+1) mod 4)/3), n = 0..200) # Gary Detlefs, Dec 29 2011
MATHEMATICA
Table[Mod[n^2, 8], {n, 0, 99}] (* Vladimir Joseph Stephan Orlovsky, Apr 21 2011 *)
Mod[Range[0, 99]^2, 8] (* Alonso del Arte, Mar 20 2015 *)
PROG
(PARI) a(n)=n^2%8 \\ Charles R Greathouse IV, Oct 07 2015
(Magma) &cat [[0, 1, 4, 1]^^30]; // Wesley Ivan Hurt, Dec 21 2016
CROSSREFS
KEYWORD
nonn,easy,mult
AUTHOR
N. J. A. Sloane, May 12 2002
STATUS
approved