login
Expansion of (x+x^2)/(1-x^6); period 6: repeat [0, 1, 1, 0, 0, 0].
3

%I #42 Dec 14 2023 05:19:32

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

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

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

%N Expansion of (x+x^2)/(1-x^6); period 6: repeat [0, 1, 1, 0, 0, 0].

%C Sequences of period k composed of (k-p) zeros followed by p ones have a closed formula of floor((n mod k)/(k-p)), for p>=floor(n/2). [_Gary Detlefs_, May 18 2011]

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

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

%F a(n) = 1/3-cos(2*Pi*n/3)/3+sin(Pi*n/3)/sqrt(3).

%F a(n) = mod(A095129(n),3).

%F a(n) = floor(((n+3) mod 6)/4). [_Gary Detlefs_, May 18 2011]

%F a(0)=0, a(1)=1, a(2)=1, a(3)=0, a(4)=0, a(n) = a(n-1)-a(n-2)+a(n-3)-a(n-4)+ a(n-5). - _Harvey P. Dale_, Nov 18 2013

%F a(n) = floor((n-1)/6) - floor((n-3)/6). - _Wesley Ivan Hurt_, Sep 08 2015

%p A095130:=n->floor(((n+3) mod 6)/4); seq(A095130(n), n=0..100); # _Wesley Ivan Hurt_, Feb 24 2014

%t PadRight[{},120,{0,1,1,0,0,0}] (* or *) LinearRecurrence[{1,-1,1,-1,1},{0,1,1,0,0},120] (* _Harvey P. Dale_, Nov 18 2013 *)

%o (Magma) [Floor(((n+3) mod 6)/4) : n in [0..100]]; // _Wesley Ivan Hurt_, Sep 08 2015

%o (Magma) &cat[[0,1,1,0,0,0]: n in [0..15]]; // _Vincenzo Librandi_, Sep 09 2015

%Y Cf. A011658, A095129.

%K easy,nonn

%O 0,1

%A _Paul Barry_, May 29 2004

%E Corrected by _T. D. Noe_, Nov 08 2006