OFFSET
0,1
FORMULA
a(n+1) = a(n) if n == 1 (mod 4), n > 1.
EXAMPLE
In the binary expansion of n = 0, we have one '0', zero '1's => 1001[2] = 9[10] = a(0).
In the binary expansion of n = 1, we have zero '0's, one '1' => 0011 = 3[10] = a(1).
In the binary expansion of n = 2 = 10[2], we have one '0', one '1' => 1011[2] = 11[10] = a(2).
In the binary expansion of n = 3 = 11[2], we have zero '0's, two (= 10[2]) '1's => a(3) = 00101[2] = 5[10].
PROG
(PARI) apply( {d(a, b=2)=fromdigits(concat([binary(logint(a+!a, 2)+1-a=hammingweight(a)), 0, if(a, binary(a)), 1]), b)}, [0..99]) \\ 2n optional arg: base in which the string of bits is to be read - i.e., b=10: write it in binary, b=2: convert to decimal!
CROSSREFS
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Nov 18 2019
STATUS
approved