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 A181132 #60 Jan 16 2025 10:41:59 %S A181132 0,0,1,1,3,4,5,5,8,10,12,13,15,16,17,17,21,24,27,29,32,34,36,37,40,42, %T A181132 44,45,47,48,49,49,54,58,62,65,69,72,75,77,81,84,87,89,92,94,96,97, %U A181132 101,104,107,109,112,114,116,117,120,122,124,125,127,128,129,129,135,140,145 %N A181132 a(0)=0; thereafter a(n) = total number of 0's in binary expansions of 1, ..., n. %C A181132 The graph of this sequence is a version of the Takagi curve: see Lagarias (2012), Section 9, especially Theorem 9.1. - _N. J. A. Sloane_, Mar 12 2016 %H A181132 Harvey P. Dale, <a href="/A181132/b181132.txt">Table of n, a(n) for n = 0..1000</a> %H A181132 Hsien-Kuei Hwang, S. Janson, and T.-H. Tsai, <a href="http://140.109.74.92/hk/wp-content/files/2016/12/aat-hhrr-1.pdf">Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications</a>, Preprint 2016. %H A181132 Hsien-Kuei Hwang, S. Janson, and T.-H. Tsai, <a href="https://doi.org/10.1145/3127585">Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications</a>, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585. %H A181132 Jeffrey C. Lagarias, <a href="https://arxiv.org/abs/1112.4205">The Takagi function and its properties</a>, arXiv:1112.4205 [math.CA], 2011-2012. %H A181132 Jeffrey C. Lagarias, <a href="http://hdl.handle.net/2433/198081">The Takagi function and its properties</a>, In Functions in number theory and their probabilistic aspects, 153--189, RIMS Kôkyûroku Bessatsu, B34, Res. Inst. Math. Sci. (RIMS), Kyoto, 2012. MR3014845. %F A181132 a(n) = A059015(n)-1. - _Klaus Brockhaus_, Oct 08 2010 %F A181132 From _N. J. A. Sloane_, Mar 10 2016: (Start) %F A181132 a(0)=0; thereafter a(2n) = a(n)+a(n-1)+n, a(2n+1) = 2a(n)+n. %F A181132 G.f.: (1/(1-x)^2) * Sum_{k >= 0} x^(2^(k+1))/(1+x^(2^k)). (End) %p A181132 a:= proc(n) option remember; `if`(n=0, 0, a(n-1)+add(1-i, i=Bits[Split](n))) end: %p A181132 seq(a(n), n=0..66); # _Alois P. Heinz_, Nov 12 2024 %t A181132 Accumulate[Count[IntegerDigits[#,2],0]&/@Range[70]] (* _Harvey P. Dale_, May 16 2012 *) %t A181132 Join[{0},Accumulate[DigitCount[Range[70],2,0]]] (* _Harvey P. Dale_, Jun 09 2016 *) %o A181132 (Word) microsoft word macro: %o A181132 Sub concatcount() Dim base As Integer Dim digit As Integer Dim counter As Integer Dim standin As Integer Dim max As Integer Let base = 2 Let digit = 0 Let max = 100 Let counter = 0 For n = 1 To max Let standin = n Do While standin > 0 If standin Mod base = digit Then Let counter = counter + 1 Let standin = standin - (standin Mod base) If standin > 0 Then Let standin = standin / base Loop Selection.TypeText Text:=Str(counter) Next n End Sub %o A181132 (Magma) [ n eq 1 select 0 else Self(n-1)+(#B-&+B) where B is Intseq(n, 2): n in [1..70] ]; // _Klaus Brockhaus_, Oct 08 2010 %o A181132 (PARI) a(n)=my(m=logint(n,2)); 1 + (m+1)*(n+1) - 2^(m+1) + sum(j=1,m+1,my(t=floor(n/2^j + 1/2));(n>>j)*(2*n + 2 - (1 + (n>>j))<<j) - (2*n + 2 - t<<j)*t)/2 \\ _Charles R Greathouse IV_, Dec 14 2015 %o A181132 (Python) %o A181132 def A181132(n): return 1+(n+1)*(m:=(n+1).bit_length())-(1<<m)-sum(i.bit_count() for i in range(1,n+1)) # _Chai Wah Wu_, Mar 02 2023 %o A181132 (Python) %o A181132 def A181132(n): return 1+(n+1)*((t:=(n+1).bit_length())-n.bit_count())-(1<<t)-(sum((m:=1<<j)*((k:=n>>j)-(r if n<<1>=m*(r:=k<<1|1) else 0)) for j in range(1,n.bit_length()+1))>>1) # _Chai Wah Wu_, Nov 11 2024 %Y A181132 Cf. A000120, A023416, A000788, A059015, A268289. %K A181132 base,easy,nonn %O A181132 0,5 %A A181132 _Dylan Hamilton_, Oct 05 2010 %E A181132 a(0)=0 added by _N. J. A. Sloane_, Mar 10 2016 (simplifies the recurrence, makes entry consistent with A059015 and other closely related sequences).