A056966 In binary: write what is described (putting a leading zero on numbers which have an odd number of binary digits).
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 2, 2, 4, 5, 3, 3, 6, 7, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0
Offset: 0
Examples
a(54)=2 because 54 = 110110 base 2, which can be read as one 1 followed by zero 1's followed by one 0, i.e., 10 base 2 = 2 base 10.
Programs
-
Python
def A056966(n): s = bin(n)[2:] s = '0'*(len(s)&1)+s return int('0'+''.join(s[i+1]*int(s[i])for i in range(0,len(s),2)),2) # Chai Wah Wu, Feb 12 2023