OFFSET
1,2
COMMENTS
a(n) = n iff n = 2^k - 1, k>0 (A000225). - Bernard Schott, Dec 18 2021
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..8191
FORMULA
MAPLE
a:= n-> Bits[Join](subs(0=[0$4][], Bits[Split](n))):
seq(a(n), n=1..49); # Alois P. Heinz, Jan 15 2021
MATHEMATICA
a[n_] := FromDigits[IntegerDigits[n, 2] /. 0 -> Sequence@@{0, 0, 0, 0}, 2];
Array[a, 50] (* Jean-François Alcover, Dec 16 2021 *)
PROG
(Haskell)
a084473 1 = 1
a084473 x = 2 * (if b == 1 then 1 else 8) * a084473 x' + b
where (x', b) = divMod x 2
-- Reinhard Zumkeller, Mar 31 2015
(Python)
def a(n): return int(bin(n)[2:].replace('0', '0000'), 2)
print([a(n) for n in range(1, 46)]) # Michael S. Branicky, Jan 15 2021
CROSSREFS
KEYWORD
AUTHOR
Reinhard Zumkeller, May 27 2003
STATUS
approved