[go: up one dir, main page]

login
A290155
Let a(n) be the sequence of 0's and 1's that represents n. Then a(0) = 0; and a((1b)_2) = 1a(|b|)b where |b| denotes the length of b.
0
0, 10, 1100, 1101, 1110000, 1110001, 1110010, 1110011, 11101000, 11101001, 11101010, 11101011, 11101100, 11101101, 11101110, 11101111, 111100000000, 111100000001, 111100000010, 111100000011, 111100000100, 111100000101, 111100000110, 111100000111
OFFSET
0,2
LINKS
Donald E. Knuth, Selected Papers on Fun and Games, Stanford, California: Center for the Study of Language and Information (2011).
EXAMPLE
(1)_2 = 1, so a(1) = 1a(0) = 10.
(2)_2 = 10, so a(2) = 1a(1)0 = 1100.
(3)_2 = 11, so a(3) = 1a(1)1 = 1101.
(4)_2 = 100, so a(4) = 1a(2)00 = 1110000.
(5)_2 = 101, so a(5) = 1a(2)01 = 1110001.
(6)_2 = 110, so a(6) = 1a(2)10 = 1110010.
(7)_2 = 111, so a(7) = 1a(2)11 = 1110011.
(8)_2 = 1000, so a(8) = 1a(3)000 = 11101000.
PROG
(Python)
def a(n):
b = bin(n)[3:]
return 0 if n == 0 else int('1' + str(a(len(b))) + b)
print([a(n) for n in range(51)]) # Indranil Ghosh, Jul 22 2017
CROSSREFS
Cf. A007088 (binary numbers).
Sequence in context: A268229 A307723 A071672 * A265849 A122230 A138147
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Jul 22 2017
STATUS
approved