cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A174571 a(4n)=n, a(4n+1)=4, a(4n+2)=1, a(4n+3)=4.

Original entry on oeis.org

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

Views

Author

Paul Curtz, Nov 29 2010

Keywords

Crossrefs

Cf. A010685.

Programs

  • Magma
    [(n mod 4) eq 0 select n/4 else Modexp(4,n,5): n in [0..90]]; // 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 *)
    LinearRecurrence[{0,0,0,2,0,0,0,-1},{0,4,1,4,1,4,1,4},100] (* Harvey P. Dale, Dec 21 2024 *)
  • PARI
    A174571(n) = if(!(n%4),n/4,if(2==(n%4),1,4)); \\ Antti Karttunen, Nov 06 2018
    
  • 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

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