OFFSET
1,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(9) = 2 because binary(9) = "1001" and 1+0+0+1=2.
a(10)= 20 because binary(10) = "1010" and 10+10=20.
a(31)= 23 because binary(31) = "11111" and 11+11+1=23.
a(100)= 120 because binary(100)= "1100100" and 110+010+0=120.
Note that several a(n) are equivalent to n: [1,20,21,1212,1213,10310,10311].
MATHEMATICA
f[n_]:=Module[{id=IntegerDigits[n, 2], len=IntegerLength[n]}, Total[ FromDigits/@ Partition[ IntegerDigits[ n, 2], len, len, {1, 1}, {}]]]; Array[f, 80] (* Harvey P. Dale, Jun 19 2018 *)
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Gil Broussard, Apr 27 2010
STATUS
approved