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 A198192 #21 Nov 14 2014 09:34:45 %S A198192 0,1,1,5,2,8,9,18,5,15,16,29,19,34,36,54,12,30,31,52,34,57,59,85,41, %T A198192 68,70,100,75,107,110,145,27,61,62,99,65,104,106,148,72,115,117,163, %U A198192 122,170,173,224,87,138,140,194,145,201,204,263,156,216,219,282,226 %N A198192 Replace 2^k in the binary representation of n with n-k (i.e. if n = 2^a + 2^b + 2^c + ... then a(n) = (n-a) + (n-b) + (n-c) + ...). %H A198192 Alois P. Heinz, <a href="/A198192/b198192.txt">Table of n, a(n) for n = 0..10000</a> %F A198192 a(n) = n*A000120(n) - A073642(n). - _Franklin T. Adams-Watters_, Oct 22 2011 %F A198192 a(n) = b(n,n) with b(0,k) = 0, b(n,k) = k*(n mod 2) + b(floor(n/2),k-1) for n>0. - _Alois P. Heinz_, Oct 25 2011 %e A198192 a(5) = (5-2) + (5-0) = 8 because 5 = 2^2 + 2^0. %e A198192 a(7) = (7-2) + (7-1) + (7-0) = 18 because 7 = 2^2 + 2^1 + 2^0. %p A198192 b:= (n, k)-> `if`(n=0, 0, k*(n mod 2)+b(floor(n/2), k-1)): %p A198192 a:= n-> b(n, n): %p A198192 seq(a(n), n=0..100); # _Alois P. Heinz_, Oct 25 2011 %o A198192 (MATLAB) % n is number of terms to be computed: %o A198192 function [B] = predAddition(n) %o A198192 for i = 0:n %o A198192 k = i; %o A198192 c = 0; %o A198192 s = 0; %o A198192 while(k ~= 0) %o A198192 if ((i - c) >= 0) %o A198192 s = s + mod(k,2)*(i-c); %o A198192 end %o A198192 c = c + 1; %o A198192 k = (k - mod(k,2))/2; %o A198192 end %o A198192 B(i+1) = s; %o A198192 end %o A198192 end %Y A198192 Cf. A000120, A073642. %K A198192 nonn,look,base %O A198192 0,4 %A A198192 _Brian Reed_, Oct 21 2011