

A162439


Write down the binary representation of n. Partition the string which is this binary representation by placing a '+' just left of every 1. Add the resulting base 2 numbers. a(n) = decimal equivalent of this sum.


4



1, 2, 2, 4, 3, 3, 3, 8, 5, 4, 4, 5, 4, 4, 4, 16, 9, 6, 6, 6, 5, 5, 5, 9, 6, 5, 5, 6, 5, 5, 5, 32, 17, 10, 10, 8, 7, 7, 7, 10, 7, 6, 6, 7, 6, 6, 6, 17, 10, 7, 7, 7, 6, 6, 6, 10, 7, 6, 6, 7, 6, 6, 6, 64, 33, 18, 18, 12, 11, 11, 11, 12, 9, 8, 8, 9, 8, 8, 8, 18, 11, 8, 8, 8, 7, 7, 7, 11, 8, 7, 7, 8, 7, 7
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Or, sum of parts of the form 10...0 with nonnegative number of zeros in binary representation of n as the corresponding powers of 2. For example, n=50 in binary is a concatenation of parts (1)(100)(10). Then a(50)=1+4+2=7.
Every positive number k occurs a finite number of times, such that the position of the last appearance of k is 2^k1.
Moreover, the number of times of appearances of k is the number of compositions of k into powers of 2, i.e., it is A023359(k), k>0. (End)


LINKS



FORMULA

Let, for k_1>k_2>...>k_r, n = 2^k_1 + 2^k_2 +...+ 2^k_r. Then a(n) = 2^(k_1k_21) + 2^(k_2k_31) + 2^(k_(r1)k_r1) + 2^k_r.  Vladimir Shevelev, Dec 11 2013


EXAMPLE

52 in binary is 110100. Placing the +'s before every 1, we get +1+10+100, which is 1+2+4 = 7 in decimal. So a(52) = 7.


MAPLE

a:= proc(n) local l, s, i, j; l:= convert(n, base, 2); s:= 0; i:=1; for j from nops(l)1 to 1 by 1 do if l[j]=0 then i:= i*2; else s:= s+i; i:= 1 fi od; s+i end: seq(a(n), n=1..150); # Alois P. Heinz, Jul 28 2009
Lton := proc(L) local i ; add(op(i, L)*2^(i1), i=1..nops(L)) ; end: A162439 := proc(n) local a, lef, b2, ri ; a := 0 ; lef := 0; b2 := convert(n, base, 2) ; for ri from lef+1 do if op(ri, b2) = 1 then a := a+Lton([op(lef+1..ri, b2)]) ; lef := ri ; fi; if ri =nops(b2) then break; fi; od: a ; end: seq(A162439(n), n=1..100) ; # R. J. Mathar, Jul 30 2009


MATHEMATICA

a[n_] := FromDigits[#, 2]& /@ Split[IntegerDigits[n, 2] , #2==0&] // Total; Array[a, 100] (* JeanFrançois Alcover, Jan 07 2016 *)


CROSSREFS



KEYWORD



AUTHOR



EXTENSIONS



STATUS

approved



