login
Period 4: repeat [0, 1, 2, 4].
0

%I #23 Dec 12 2023 09:34:17

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

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

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

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

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

%F a(n+4) = a(n).

%F a(n) = floor((5*n+1)/4) mod 5. - _Gary Detlefs_, May 15 2011

%F From _Bruno Berselli_, May 16 2011: (Start)

%F G.f.: x*(1+2*x+4*x^2)/(1-x^4).

%F a(n) = (5-(-1)^n)*(6-2*I^(n*(n-1)))/8-2. (End)

%F From _Wesley Ivan Hurt_, Jul 09 2016: (Start)

%F a(n) = (7-3*I^(2*n)-(2+3*I)*I^(-n)-(2-3*I)*I^n)/4.

%F a(n) = (7-3*cos(n*Pi)-4*cos(n*Pi/2)-6*sin(n*Pi/2)-3*I*sin(n*Pi))/4. (End)

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

%t PadRight[{}, 100, {0, 1, 2, 4}] (* _Wesley Ivan Hurt_, Jul 09 2016 *)

%o (Magma) &cat [[0, 1, 2, 4]^^30]; // _Wesley Ivan Hurt_, Jul 09 2016

%K nonn,easy

%O 0,3

%A _Paul Curtz_, Jun 21 2007

%E Name rewritten by _Bruno Berselli_, May 16 2011