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 A239904 #29 Feb 12 2023 12:40:28 %S A239904 0,0,1,2,3,3,5,6,7,7,8,9,11,11,13,14,15,15,16,17,18,18,20,21,23,23,24, %T A239904 25,27,27,29,30,31,31,32,33,34,34,36,37,38,38,39,40,42,42,44,45,47,47, %U A239904 48,49,50,50,52,53,55,55,56,57,59,59,61,62,63,63,64,65,66,66,68,69,70,70,71,72,74,74,76 %N A239904 a(n) = n - wt(n) + (number of times 11 appears in binary expansion of n). %C A239904 This is G_{2, 1/4}(n) in Prodinger's notation. %H A239904 Gheorghe Coserea, <a href="/A239904/b239904.txt">Table of n, a(n) for n = 0..10000</a> %H A239904 Helmut Prodinger, <a href="http://dx.doi.org/10.1137/0603004">Generalizing the sum of digits function</a>, SIAM J. Algebraic Discrete Methods 3 (1982), no. 1, 35--42. MR0644955 (83f:10009). %F A239904 a(n) = n - A000120(n) + A014081(n). %p A239904 A000120 := proc(n) add(i, i=convert(n, base, 2)) end: %p A239904 # A014081: %p A239904 cn := proc(v, k) local n, s, nn, i, j, som, kk; %p A239904 som := 0; %p A239904 kk := convert(cat(seq(1, j = 1 .. k)),string); %p A239904 n := convert(v, binary); %p A239904 s := convert(n, string); %p A239904 nn := length(s); %p A239904 for i to nn - k + 1 do %p A239904 if substring(s, i .. i + k - 1) = kk then som := som + 1 fi od; %p A239904 som; end; %p A239904 [seq(n-A000120(n)+cn(n,2), n=0..100)]; %t A239904 cn[n_, k_] := Count[Partition[IntegerDigits[n, 2], k, 1], Table[1, {k}]]; Table[n - DigitCount[n, 2, 1] + cn[n, 2], {n, 0, 78}] (* _Michael De Vlieger_, Sep 18 2015 *) %o A239904 (PARI) %o A239904 a(n) = n - hammingweight(n) + hammingweight(bitand(n, n>>1)); %o A239904 vector(79, i, a(i-1)) \\ _Gheorghe Coserea_, Sep 24 2015 %o A239904 (Python) %o A239904 def A239904(n): return n-n.bit_count()+(n&(n>>1)).bit_count() # _Chai Wah Wu_, Feb 12 2023 %Y A239904 Cf. A000120, A014081, A239906, A239907. %K A239904 nonn,base %O A239904 0,4 %A A239904 _N. J. A. Sloane_, Apr 06 2014