login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 3
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

From Vladimir Shevelev, Dec 11 2014: (Start)

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^k-1.

  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

Alois P. Heinz, Table of n, a(n) for n = 1..10000

FORMULA

Let, for k_1>k_2>...>k_r, n = 2^k_1 + 2^k_2 +...+ 2^k_r. Then a(n) = 2^(k_1-k_2-1) + 2^(k_2-k_3-1) + 2^(k_(r-1)-k_r-1) + 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^(i-1), 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] (* Jean-Fran├žois Alcover, Jan 07 2016 *)

CROSSREFS

Cf. A124771, A233249, A233312, A233416, A233420, A233564, A233569, A233655.

Sequence in context: A260951 A240600 A227183 * A154417 A292421 A205563

Adjacent sequences:  A162436 A162437 A162438 * A162440 A162441 A162442

KEYWORD

base,nonn,look

AUTHOR

Leroy Quet, Jul 03 2009

EXTENSIONS

More terms from Alois P. Heinz and R. J. Mathar, Jul 28 2009

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 15 13:06 EDT 2019. Contains 328030 sequences. (Running on oeis4.)