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 A236840 #23 Jul 16 2023 02:08:13 %S A236840 0,0,0,2,2,2,4,6,6,6,6,8,10,10,12,14,14,14,14,16,16,16,18,20,22,22,22, %T A236840 24,26,26,28,30,30,30,30,32,32,32,34,36,36,36,36,38,40,40,42,44,46,46, %U A236840 46,48,48,48,50,52,54,54,54,56,58,58,60,62,62,62,62,64,64,64 %N A236840 n minus number of runs in the binary expansion of n: a(n) = n - A005811(n). %C A236840 All terms are even. Used by the "number-of-runs beanstalk" sequence A255056 and many of its associated sequences. %H A236840 Antti Karttunen, <a href="/A236840/b236840.txt">Table of n, a(n) for n = 0..8192</a> %F A236840 a(n) = n - A005811(n) = n - A000120(A003188(n)). %F A236840 a(n) = 2*A255070(n). %p A236840 A236840 := proc(n) local i, b; if n=0 then 0 else b := convert(n, base, 2); select(i -> (b[i-1]<>b[i]), [$2..nops(b)]); n-1-nops(%) fi end: seq(A236840(i), i=0..69); # _Peter Luschny_, Apr 19 2014 %t A236840 a[n_] := n - Length@ Split[IntegerDigits[n, 2]]; a[0] = 0; Array[a, 100, 0] (* _Amiram Eldar_, Jul 16 2023 *) %o A236840 (Scheme) (define (A236840 n) (- n (A005811 n))) %Y A236840 Cf. A091067 (the positions of records), A106836 (run lengths). %Y A236840 Cf. A255070 (terms divided by 2). %Y A236840 Cf. A005811, A000120, A003188. %Y A236840 Cf. A255056, A255066, A255061, A255062, A255071, A255072, A255058, A255327. %Y A236840 Other subtracting maps: A011371, A178503, A219641, A219651, A227190, A227191, A237449, A244320, A244234, A255131. %K A236840 nonn,base %O A236840 0,4 %A A236840 _Antti Karttunen_, Apr 18 2014