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!)
A131743 Period 4: repeat [0, 1, 0, 2]. 7

%I #49 Dec 12 2023 09:26:14

%S 0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,

%T 0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,

%U 0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0

%N Period 4: repeat [0, 1, 0, 2].

%C Least positive integer k such that n^k == 1 (mod 4), or 0 if GCD(n,4) > 1. - _Bruno Berselli_, Mar 22 2016

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

%F G.f.: x*(1+2*x^2)/ ((1-x)*(x+1)*(x^2+1)). - _R. J. Mathar_, Nov 15 2007

%F a(n) = 3/4-1/2*sin(1/2*Pi*n)+3/4*(-1)^(1+n). - _R. J. Mathar_, Nov 15 2007

%F a(n) = Fibonacci(2*n) mod 3. - _Gary Detlefs_ Feb 13 2011

%F a(n) == A006368(n) (mod 3). - _Philippe Deléham_, Oct 24 2011

%F a(n) = a(n-4) for n>3. - _Wesley Ivan Hurt_, Jul 09 2016

%p seq(op([0, 1, 0, 2]), n=0..50); # _Wesley Ivan Hurt_, Jul 09 2016

%t PadRight[{}, 106, {0, 1, 0, 2}] (* _Harvey P. Dale_, Apr 06 2012 *)

%t CoefficientList[Series[x (1 + 2 x^2)/((1 - x) (x + 1) (x^2 + 1)), {x, 0, 120}], x] (* _Michael De Vlieger_, Jul 09 2016 *)

%o (Magma) &cat [[0, 1, 0, 2]^^30]; // _Bruno Berselli_, Mar 22 2016

%o (PARI) x='x+O('x^200); concat(0, Vec(-x*(1+2*x^2)/((x-1)*(x+1)*(x^2+1)))) \\ _Altug Alkan_, Mar 22 2016

%o (PARI) a(n)=n%2*(n%4+1)/2 \\ _Charles R Greathouse IV_, Mar 22 2016

%o (Python)

%o def A131743(n): return (0,1,0,2)[n&3] # _Chai Wah Wu_, Jul 29 2023

%Y Cf. A006368.

%K nonn,easy

%O 0,4

%A _Paul Curtz_, Sep 20 2007

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 24 19:24 EDT 2024. Contains 371962 sequences. (Running on oeis4.)