OFFSET
1,3
LINKS
FORMULA
a(n) = (9 * n mod 2 + 1) * a(floor(n/2)) + n mod 2. - Reinhard Zumkeller, Oct 10 2012
MATHEMATICA
Table[FromDigits[DeleteCases[IntegerDigits[n, 2], _?(#==0&)]], {n, 60}] (* Harvey P. Dale, Feb 27 2012 *)
FromDigits/@(IntegerDigits[Range[60], 2]/.(0->Nothing)) (* Harvey P. Dale, Apr 09 2017 *)
PROG
(Haskell)
a038585 0 = 0
a038585 n = (9 * m + 1) * (a038585 n') + m where (n', m) = divMod n 2
-- Reinhard Zumkeller, Oct 10 2012
(Python)
def A038585(n):
return int(bin(n)[2:].replace('0', '')) # Chai Wah Wu, May 19 2020
CROSSREFS
KEYWORD
nonn,easy,base,nice
AUTHOR
EXTENSIONS
More terms from Erich Friedman
STATUS
approved