This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A037861 #91 Aug 07 2024 09:19:18 %S A037861 1,-1,0,-2,1,-1,-1,-3,2,0,0,-2,0,-2,-2,-4,3,1,1,-1,1,-1,-1,-3,1,-1,-1, %T A037861 -3,-1,-3,-3,-5,4,2,2,0,2,0,0,-2,2,0,0,-2,0,-2,-2,-4,2,0,0,-2,0,-2,-2, %U A037861 -4,0,-2,-2,-4,-2,-4,-4,-6,5,3,3,1,3,1,1,-1,3 %N A037861 (Number of 0's) - (number of 1's) in the base-2 representation of n. %C A037861 -Sum_{n>=1} a(n)/((2*n)*(2*n+1)) = the "alternating Euler constant" log(4/Pi) = 0.24156... - (see A094640 and Sondow 2005, 2010). %C A037861 a(A072600(n)) < 0; a(A072601(n)) <= 0; a(A031443(n)) = 0; a(A072602(n)) >= 0; a(A072603(n)) > 0; a(A031444(n)) = 1; a(A031448(n)) = -1; abs(a(A089648(n))) <= 1. - _Reinhard Zumkeller_, Feb 07 2015 %H A037861 Reinhard Zumkeller, <a href="/A037861/b037861.txt">Table of n, a(n) for n = 0..10000</a> %H A037861 Jonathan Sondow, <a href="https://arxiv.org/abs/math/0211148"> Double integrals for Euler's constant and ln(4/Pi) and an analog of Hadjicostas's formula</a>, arXiv:math/0211148 [math.CA], 2002-2004; Amer. Math. Monthly 112 (2005), 61-65. %H A037861 Jonathan Sondow, <a href="https://arxiv.org/abs/math/0508042">New Vacca-Type Rational Series for Euler's Constant and Its "Alternating" Analog ln(4/Pi)</a>, arXiv:math/0508042 [math.NT], 2005; Additive Number Theory, Festschrift In Honor of the Sixtieth Birthday of Melvyn B. Nathanson (D. Chudnovsky and G. Chudnovsky, eds.), Springer, 2010, pp. 331-340. %H A037861 Ralf Stephan, <a href="https://arxiv.org/abs/math/0307027">Divide-and-conquer generating functions. I. Elementary sequences</a>, arXiv:math/0307027 [math.CO], 2003. %H A037861 Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences with (relatively) simple ordinary generating functions</a>, 2004. %H A037861 Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions (ps file)</a>. %H A037861 Ralf Stephan, <a href="/A037861/a037861.pdf">Table of generating functions (pdf file)</a>. %H A037861 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A037861 From _Henry Bottomley_, Oct 27 2000: (Start) %F A037861 a(n) = A023416(n) - A000120(n) = A029837(n) - 2*A000120(n) = 2*A023416(n) - A029837(n). %F A037861 a(2*n) = a(n) + 1; a(2*n + 1) = a(2*n) - 2 = a(n) - 1. (End) %F A037861 G.f. satisfies A(x) = (1 + x)*A(x^2) - x*(2 + x)/(1 + x). - _Franklin T. Adams-Watters_, Dec 26 2006 %F A037861 a(n) = b(n) for n > 0 with b(0) = 0 and b(n) = b(floor(n/2)) + (-1)^(n mod 2). - _Reinhard Zumkeller_, Dec 31 2007 %F A037861 G.f.: 1 + (1/(1 - x))*Sum_{k>=0} x^(2^k)*(x^(2^k) - 1)/(1 + x^(2^k)). - _Ilya Gutkovskiy_, Apr 07 2018 %p A037861 A037861:= proc(n) local L; %p A037861 L:= convert(n,base,2); %p A037861 numboccur(0,L) - numboccur(1,L) %p A037861 end proc: %p A037861 map(A037861, [$0..100]); # _Robert Israel_, Mar 08 2016 %t A037861 Table[Count[ IntegerDigits[n, 2], 0] - Count[IntegerDigits[n, 2], 1], {n, 0, 75}] %o A037861 (Haskell) %o A037861 a037861 n = a023416 n - a000120 n -- _Reinhard Zumkeller_, Aug 01 2013 %o A037861 (Python) %o A037861 def A037861(n): %o A037861 return 2*format(n,'b').count('0')-len(format(n,'b')) # _Chai Wah Wu_, Mar 07 2016 %o A037861 (PARI) a(n) = if (n==0, 1, 1 + logint(n, 2) - 2*hammingweight(n)); \\ _Michel Marcus_, May 15 2020 and Jun 16 2020 %Y A037861 Cf. A031443 for n when a(n)=0, A053738 for n when a(n) odd, A053754 for n when a(n) even, A030300 for a(n+1) mod 2. %Y A037861 Cf. A066879, A094640, A110625, A145037. %Y A037861 Cf. A072600, A072601, A072602, A072603, A031444, A031448, A089648. %Y A037861 See A268289 for a recurrence based on this sequence. %K A037861 base,sign,look,easy %O A037861 0,4 %A A037861 _Clark Kimberling_