cp's OEIS Frontend

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.

A198193 Replace 2^k in the binary representation of n with n+(k-L) where L = floor(log(n)/log(2)).

This page as a plain text file.
%I A198193 #27 Mar 13 2021 23:43:13
%S A198193 0,1,2,5,4,8,11,18,8,15,18,28,23,35,39,54,16,30,33,50,38,57,61,83,47,
%T A198193 70,74,100,81,109,114,145,32,61,64,96,69,103,107,144,78,116,120,161,
%U A198193 127,170,175,221,95,141,145,194,152,203,208,262,165,220,225,283
%N A198193 Replace 2^k in the binary representation of n with n+(k-L) where L = floor(log(n)/log(2)).
%C A198193 That is, if n = 2^a + 2^b + 2^c + ... then a(n) = (n+(a-L)) + (n+(b-L)) + (n+(c-L)) + ...).
%F A198193 Let L = A000523(n), then a(n) = (n-L)*A000120(n) + A073642(n).
%e A198193 a(4) = (4+(2-2)) = 4 because int(log(4)/log(2)) = 2 and 4 = 2^2.
%e A198193 a(6) = (6+(2-2)) + (6+(1-2)) = 11 because int(log(6)/log(2)) = 2 and 6 = 2^2 + 2^1.
%p A198193 read("transforms") :
%p A198193 A198193 := proc(n)
%p A198193         (n-A000523(n))*wt(n)+A073642(n) ;
%p A198193 end proc:
%p A198193 seq(A198193(n),n=0..20) ; # _R. J. Mathar_, Nov 17 2011
%t A198193 Table[b = Reverse[IntegerDigits[n, 2]]; L = Length[b] - 1; Sum[b[[k]] (n + k - 1 - L), {k, Length[b]}], {n, 0, 59}] (* _T. D. Noe_, Nov 01 2011 *)
%o A198193 (MATLAB)
%o A198193 % n is number of terms to be computed, b is the base. The examples all use b=2:
%o A198193 function [V] = revAddition(n,b)
%o A198193    for i = 0:n
%o A198193       k = i;
%o A198193       if (i > 0)
%o A198193          l = floor(log(i)/log(b));
%o A198193       end
%o A198193       s = 0;
%o A198193       while(k ~= 0)
%o A198193          if ((i-l) >= 0)
%o A198193             s = s + mod(k,b)*(i-l);
%o A198193          end
%o A198193          l = l - 1;
%o A198193          k = (k - mod(k,b))/b;
%o A198193       end
%o A198193       V(i+1) = s;
%o A198193    end
%o A198193 end
%o A198193 (Python)
%o A198193 def A198193(n): return sum((n-i)*int(j) for i,j in enumerate(bin(n)[2:])) # _Chai Wah Wu_, Mar 13 2021
%Y A198193 Cf. A000120, A073642, A198192.
%K A198193 nonn,base
%O A198193 0,3
%A A198193 _Brian Reed_, Oct 26 2011