OFFSET
0,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..16383
Index entries for linear recurrences with constant coefficients, signature (0,0,0,2,0,0,0,-1).
FORMULA
a(n) = A010685(n) if 4 does not divide n.
a(n) = 2*a(n-4) - a(n-8).
G.f.: x*(4 + x + 4*x^2 + x^3 - 4*x^4 - x^5 - 4*x^6)/( (1-x)*(1+x)*(1+x^2) )^2.
a(n) = (36 +n +(n-28)*(-1)^n +2*(n -5 +(-1)^n)*cos(n*Pi/2) +(1+(-1)^n)*sin(n*Pi/2) )/16. - Wesley Ivan Hurt, May 07 2021
E.g.f.: (1/8)*(4*cosh(x) + (x+32)*sinh(x) - 4*cos(x) - x*sin(x)). - G. C. Greubel, Nov 23 2021
MATHEMATICA
Array[Which[OddQ@ Mod[#, 4], 4, Mod[#, 4] == 0, #/4, True, 1] &, 84, 0] (* or *)
CoefficientList[Series[x*(4 +x +4*x^2 +x^3 -4*x^4 -x^5 -4*x^6)/(1-x^4)^2, {x, 0, 83}], x] (* Michael De Vlieger, Nov 06 2018 *)
PROG
(PARI) A174571(n) = if(!(n%4), n/4, if(2==(n%4), 1, 4)); \\ Antti Karttunen, Nov 06 2018
(Magma) [(n mod 4) eq 0 select n/4 else Modexp(4, n, 5): n in [0..90]]; // G. C. Greubel, Nov 23 2021
(Sage)
def A174571(n): return n/4 if (n%4==0) else power_mod(4, n, 5)
[A174571(n) for n in (0..90)] # G. C. Greubel, Nov 23 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Nov 29 2010
STATUS
approved