%I #44 Jan 30 2023 11:11:38
%S 0,0,0,0,2,2,2,2,4,4,4,4,6,6,6,6,8,8,8,8,10,10,10,10,12,12,12,12,14,
%T 14,14,14,16,16,16,16,18,18,18,18,20,20,20,20,22,22,22,22,24,24,24,24,
%U 26,26,26,26,28,28,28,28,30,30,30,30,32,32,32,32,34,34,34,34,36,36,36,36
%N Repetitions of even numbers four times.
%C Number of roots of P(x) = 1 + x + x^2 + … + x^n in the right half-plane. - _Michel Lagneau_, Oct 30 2012
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).
%F a(n) = (Sum_{k=0..n} (k+1)*cos((n-k)*Pi/2))+1/4*(2*cos(n*Pi/2)+1+(-1)^n)-2. - _Paolo P. Lava_, May 15 2007
%F a(n) = 2*A002265(n) = 2*A180969(2,n). [_Adriano Caroli_, Nov 25 2010, corrected by _R. J. Mathar_, Nov 26 2010]
%F G.f.: 2*x^4/(1-x-x^4+x^5). [_Bruno Berselli_, Oct 31 2012]
%F a(n) = (-3+(-1)^n+2*i^((n-1)*n)+2*n)/4, where i=sqrt(-1). [_Bruno Berselli_, Oct 31 2012]
%F a(n) = 2 * floor(n/4). - _Wesley Ivan Hurt_, Dec 06 2013
%F a(n) = (2*n-3+2*cos(n*Pi/2)+cos(n*Pi)+2*sin(n*Pi/2))/4. - _Wesley Ivan Hurt_, Oct 02 2017
%p with(numtheory): for n from 1 to 70 do:it:=0:y:=[fsolve(sum('x^i ', 'i'=0..n-1), x, complex)] : for m from 1 to nops(y) do : if Re(y[m]) > 0 then it:=it+1:else fi:od: printf(`%d, `,it):od: # _Michel Lagneau_, Oct 31 2012
%p A122461:=n->2*floor(n/4); seq(A122461(n), n=0..100); # _Wesley Ivan Hurt_, Dec 06 2013
%t Table[2 Floor[n/4], {n, 0, 100}] (* _Wesley Ivan Hurt_, Dec 06 2013 *)
%t Table[PadRight[{},4,2n],{n,0,20}]//Flatten (* or *) LinearRecurrence[ {1,0,0,1,-1},{0,0,0,0,2},80] (* _Harvey P. Dale_, Mar 15 2020 *)
%o (Python)
%o def A122461(n): return n>>1&-2 # _Chai Wah Wu_, Jan 30 2023
%Y Cf. A002265, A092533, A180969.
%K nonn,easy
%O 0,5
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Oct 20 2006
|