login
A174571
a(4n)=n, a(4n+1)=4, a(4n+2)=1, a(4n+3)=4.
2
0, 4, 1, 4, 1, 4, 1, 4, 2, 4, 1, 4, 3, 4, 1, 4, 4, 4, 1, 4, 5, 4, 1, 4, 6, 4, 1, 4, 7, 4, 1, 4, 8, 4, 1, 4, 9, 4, 1, 4, 10, 4, 1, 4, 11, 4, 1, 4, 12, 4, 1, 4, 13, 4, 1, 4, 14, 4, 1, 4, 15, 4, 1, 4, 16, 4, 1, 4, 17, 4, 1, 4, 18, 4, 1, 4, 19, 4, 1, 4, 20, 4, 1, 4
OFFSET
0,2
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
Cf. A010685.
Sequence in context: A331291 A080905 A010685 * A099301 A244971 A050347
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Nov 29 2010
STATUS
approved