The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A198193 Replace 2^k in the binary representation of n with n+(k-L) where L = floor(log(n)/log(2)). 1
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, 70, 74, 100, 81, 109, 114, 145, 32, 61, 64, 96, 69, 103, 107, 144, 78, 116, 120, 161, 127, 170, 175, 221, 95, 141, 145, 194, 152, 203, 208, 262, 165, 220, 225, 283 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
That is, if n = 2^a + 2^b + 2^c + ... then a(n) = (n+(a-L)) + (n+(b-L)) + (n+(c-L)) + ...).
LINKS
FORMULA
Let L = A000523(n), then a(n) = (n-L)*A000120(n) + A073642(n).
EXAMPLE
a(4) = (4+(2-2)) = 4 because int(log(4)/log(2)) = 2 and 4 = 2^2.
a(6) = (6+(2-2)) + (6+(1-2)) = 11 because int(log(6)/log(2)) = 2 and 6 = 2^2 + 2^1.
MAPLE
read("transforms") :
A198193 := proc(n)
(n-A000523(n))*wt(n)+A073642(n) ;
end proc:
seq(A198193(n), n=0..20) ; # R. J. Mathar, Nov 17 2011
MATHEMATICA
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 *)
PROG
(MATLAB)
% n is number of terms to be computed, b is the base. The examples all use b=2:
function [V] = revAddition(n, b)
for i = 0:n
k = i;
if (i > 0)
l = floor(log(i)/log(b));
end
s = 0;
while(k ~= 0)
if ((i-l) >= 0)
s = s + mod(k, b)*(i-l);
end
l = l - 1;
k = (k - mod(k, b))/b;
end
V(i+1) = s;
end
end
(Python)
def A198193(n): return sum((n-i)*int(j) for i, j in enumerate(bin(n)[2:])) # Chai Wah Wu, Mar 13 2021
CROSSREFS
Sequence in context: A183542 A328203 A080031 * A316905 A214533 A065221
KEYWORD
nonn,base
AUTHOR
Brian Reed, Oct 26 2011
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 3 18:45 EDT 2024. Contains 373087 sequences. (Running on oeis4.)