%I #126 Oct 24 2024 10:28:18
%S 0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15,
%T 0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,
%U 29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0,38,0,39,0,40,0,41,0,42,0,43,0
%N The nonnegative integers interleaved with 0's.
%C Number of vertical pairs in a wheel with n equal sections. - _Wesley Ivan Hurt_, Jan 22 2012
%C Number of even terms of n-th row in the triangles A162610 and A209297. - _Reinhard Zumkeller_, Jan 19 2013
%C Also the result of writing n-1 in base 2 and multiplying the last digit with the number with its last digit removed. See A115273 and A257844-A257850 for generalization to other bases. - _M. F. Hasler_, May 10 2015
%C Also follows the rule: a(n+1) is the number of terms that are identical with a(n) for a(0..n-1). - _Marc Morgenegg_, Jul 08 2019
%H Vincenzo Librandi, <a href="/A142150/b142150.txt">Table of n, a(n) for n = 0..1000</a>
%H Reinhard Zumkeller, <a href="/A142149/a142149.txt">Logical Convolutions</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,2,0,-1).
%F a(n) = XOR{k AND (n-k): 0<=k<=n}.
%F a(n) = (n/2)*0^(n mod 2); a(2*n)=n and a(2*n+1)=0.
%F a(n) = floor(n^2/2) mod n. - _Enrique Pérez Herrero_, Jul 29 2009
%F a(n) = A027656(n-2). - _Reinhard Zumkeller_, Nov 05 2009
%F a(n) = Sum_{k=0..n} (k mod 2)*((n-k) mod 2). - _Reinhard Zumkeller_, Nov 05 2009
%F a(n+1) = A000217(n) mod A000027(n+1) = A000217(n) mod A001477(n+1). - Edgar Almeida Ribeiro (edgar.a.ribeiro(AT)gmail.com), May 19 2010
%F From _Bruno Berselli_, Oct 19 2010: (Start)
%F a(n) = n*(1+(-1)^n)/4.
%F G.f.: x^2/(1-x^2)^2.
%F a(n) = 2*a(n-2)-a(n-4) for n > 3.
%F Sum_{i=0..n} a(i) = (2*n*(n+1)+(2*n+1)*(-1)^n-1)/16 (see A008805). (End)
%F a(n) = -a(-n) = A195034(n-1)-A195034(-n-1). - _Bruno Berselli_, Oct 12 2011
%F a(n) = A000326(n) - A191967(n). - _Reinhard Zumkeller_, Jul 07 2012
%F a(n) = Sum_{i=1..n} floor((2*i-n)/2). - _Wesley Ivan Hurt_, Aug 21 2014
%F a(n-1) = floor(n/2)*(n mod 2), where (n mod 2) is the parity of n, or remainder of division by 2. - _M. F. Hasler_, May 10 2015
%F a(n) = A158416(n) - 1. - _Filip Zaludek_, Oct 30 2016
%F E.g.f.: x*sinh(x)/2. - _Ilya Gutkovskiy_, Oct 30 2016
%F a(n) = A000007(a(n-1)) + a(n-2) for n > 1. - _Nicolas Bělohoubek_, Oct 06 2024
%p A142150:=n->n*(1+(-1)^n)/4: seq(A142150(n), n=0..100); # _Wesley Ivan Hurt_, Aug 21 2014
%t Table[Mod[Floor[n^2/2], n], {n, 200}] (* _Enrique Pérez Herrero_, Jul 29 2009 *)
%t Riffle[Range[0, 50], 0] (* _Paolo Xausa_, Feb 08 2024 *)
%o (Haskell)
%o a142150 = uncurry (*) . (`divMod` 2) . (+ 1)
%o a142150_list = scanl (+) 0 a001057_list
%o -- _Reinhard Zumkeller_, Apr 02 2012
%o (Magma) [n*(1+(-1)^n)/4 : n in [0..100]]; // _Wesley Ivan Hurt_, Aug 21 2014
%o (PARI) a(n)=!bittest(n,0)*n>>1 \\ _M. F. Hasler_, May 10 2015
%o (Magma) &cat[[n, 0]: n in [0..50]]; // _Vincenzo Librandi_, Oct 31 2016
%o (Python)
%o def A142150(n): return (n+1>>1)*(n&1^1) # _Chai Wah Wu_, Jan 19 2023
%Y Cf. A000004, A000007, A000027, A000217, A000326, A001057, A001477, A003817, A008805, A027656, A086099, A142149, A142151, A162610, A191967, A195034, A209297.
%K nonn,easy,changed
%O 0,5
%A _Reinhard Zumkeller_, Jul 15 2008