login
Expansion of (1+x)(1-x+x^2)/((1-x)(1+x^2)).
6

%I #32 Sep 08 2022 08:45:14

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

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

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

%N Expansion of (1+x)(1-x+x^2)/((1-x)(1+x^2)).

%C Transform of A011782 under the Chebyshev mapping g(x)-> ((1-x^2)/(1+x^2)) * g(x/(1+x^2)).

%C Binomial transform is A098179.

%C Multiplicative with a(2) = 0, a(2^e) = 2 if e >= 2, a(p^e) = 1. [_David W. Wilson_, Jun 12 2005]

%C 1, followed by period 4, repeat [1, 0, 1, 2]. [_Joerg Arndt_, Jan 06 2014]

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

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

%F a(n) = 1 + cos(Pi*n/2) - 0^n.

%F a(n) = a(n-1) - a(n-2) + a(n-3) for n>2.

%F a(n) = A007877(n+2), n>0. Dirichlet g.f. (1-1/2^s+2/4^s)*zeta(s). - _R. J. Mathar_, Feb 24 2011

%F a(n) = sign(n) - 1 + sqrt((n-2)^2 mod 8). - _Wesley Ivan Hurt_, Jan 04 2014

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

%F E.g.f.: exp(x) + cos(x) - 1. - _Ilya Gutkovskiy_, Jul 07 2016

%p with(numtheory); A098178:=n->signum(n)-1+sqrt((n-2)^2 mod 8); seq(A098178(n), n=0..100); # _Wesley Ivan Hurt_, Jan 04 2014

%t CoefficientList[Series[(1+x)(1-x+x^2)/((1-x)(1+x^2)),{x,0,120}],x] (* or *) PadRight[{1},120,{2,1,0,1}] (* _Harvey P. Dale_, May 01 2013 *)

%t Table[Sign[n] - 1 + Sqrt[Mod[(n - 2)^2, 8]], {n, 0, 100}] (* _Wesley Ivan Hurt_, Jan 04 2014 *)

%t Join[{1},LinearRecurrence[{1, -1, 1},{1, 0, 1},104]] (* _Ray Chandler_, Sep 03 2015 *)

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

%Y Cf. A007877, A098179.

%K easy,nonn,mult

%O 0,5

%A _Paul Barry_, Aug 30 2004