login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A174571 a(4n)=n, a(4n+1)=4, a(4n+2)=1, a(4n+3)=4. 2

%I #26 Sep 08 2022 08:45:51

%S 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,

%T 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,

%U 4,1,4,17,4,1,4,18,4,1,4,19,4,1,4,20,4,1,4

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

%H Antti Karttunen, <a href="/A174571/b174571.txt">Table of n, a(n) for n = 0..16383</a>

%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,2,0,0,0,-1).

%F a(n) = A010685(n) if 4 does not divide n.

%F a(n) = 2*a(n-4) - a(n-8).

%F 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.

%F 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

%F E.g.f.: (1/8)*(4*cosh(x) + (x+32)*sinh(x) - 4*cos(x) - x*sin(x)). - _G. C. Greubel_, Nov 23 2021

%t Array[Which[OddQ@ Mod[#, 4], 4, Mod[#, 4] == 0, #/4, True, 1] &, 84, 0] (* or *)

%t 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 *)

%o (PARI) A174571(n) = if(!(n%4),n/4,if(2==(n%4),1,4)); \\ _Antti Karttunen_, Nov 06 2018

%o (Magma) [(n mod 4) eq 0 select n/4 else Modexp(4,n,5): n in [0..90]]; // _G. C. Greubel_, Nov 23 2021

%o (Sage)

%o def A174571(n): return n/4 if (n%4==0) else power_mod(4,n,5)

%o [A174571(n) for n in (0..90)] # _G. C. Greubel_, Nov 23 2021

%Y Cf. A010685.

%K nonn,easy

%O 0,2

%A _Paul Curtz_, Nov 29 2010

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 17:08 EDT 2024. Contains 371749 sequences. (Running on oeis4.)