Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #40 Dec 17 2023 07:00:38
%S 0,0,1,2,1,1,2,3,2,2,3,4,3,3,4,5,4,4,5,6,5,5,6,7,6,6,7,8,7,7,8,9,8,8,
%T 9,10,9,9,10,11,10,10,11,12,11,11,12,13,12,12,13,14,13,13,14,15,14,14,
%U 15,16,15,15,16,17,16,16,17,18,17,17,18,19,18,18,19,20,19,19,20,21,20,20,21,22,21,21,22,23,22,22,23
%N 2-adic valuation of the number of involutions of n (A000085).
%H Vincenzo Librandi, <a href="/A246552/b246552.txt">Table of n, a(n) for n = 0..1000</a>
%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) = a(n-1) + a(n-4) - a(n-5).
%F G.f.: x^2*(1+x-x^2)/((1-x)^2*(1+x)*(1+x^2)).
%F a(n) = (3 - (-1)^n - (1+3*i)*(-i)^n - (1-i*3)*i^n + 2*n)/8 where i=sqrt(-1). - _Colin Barker_, Oct 16 2015
%F a(n) = (2*n+3-2*cos(n*Pi/2)-cos(n*Pi)-6*sin(n*Pi/2))/8. - _Wesley Ivan Hurt_, Oct 01 2017
%F a(n) = n - 2*floor(n/4) - floor((n+3)/4). - _Ridouane Oudra_, Dec 11 2023
%p seq(n-2*floor(n/4)-floor((n+3)/4), n=0..100) ; # _Ridouane Oudra_, Dec 11 2023
%t CoefficientList[Series[x^2 (1 + x - x^2)/((1 - x)^2 (1 + x) (1 + x^2)), {x, 0, 100}], x] (* _Vincenzo Librandi_, Sep 06 2014 *)
%t LinearRecurrence[{1,0,0,1,-1},{0,0,1,2,1},100] (* _Harvey P. Dale_, Jun 13 2016 *)
%o (PARI) N=166; x='x+O('x^N);
%o v=Vec(serlaplace(exp(x+x^2/2)));
%o vector(#v,n,valuation(v[n],2))
%o (PARI) concat([0,0],Vec(x^2*(1+x-x^2)/((1-x)^2*(1+x)*(1+x^2))+O(x^166)))
%o (Magma) I:=[0, 0, 1, 2, 1]; [n le 5 select I[n] else Self(n-1)+Self(n-4)-Self(n-5): n in [1..100]]; // _Vincenzo Librandi_, Sep 06 2014
%o (PARI) a(n) = (3 - (-1)^n - (1+3*I)*(-I)^n - (1-I*3)*I^n + 2*n)/8 \\ _Colin Barker_, Oct 16 2015
%Y Cf. A000085 (involutions).
%Y Cf. A011371 (2-adic valuation of n!), A007814 (2-adic valuation of derangements (A000166)).
%K nonn,easy
%O 0,4
%A _Joerg Arndt_, Sep 06 2014