Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A165415
a(n) = the smallest positive integer that contains more digits written in binary than n has written in binary, and which does not contain binary n as a substring in its binary representation.
0
7, 4, 10, 8, 8, 8, 18, 16, 16, 16, 16, 16, 16, 16, 34, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 66, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 130, 128, 128, 128, 128, 128, 128
OFFSET
2,1
FORMULA
a(2) = 7. For n >=2: a(2^n) = 2^(n+1) + 2; for m such that 2^(n-1)+1 <= m <= 2^n-1, a(m) = 2^n.
PROG
(Python)
def a(n):
if n == 2: return 7
digs = n.bit_length()
return int(2**digs) if n != 2**(digs - 1) else int(2**digs + 2)
print([a(n) for n in range(2, 71)]) # Michael S. Branicky, Jul 04 2021
CROSSREFS
Sequence in context: A195452 A103227 A335166 * A069199 A359014 A138339
KEYWORD
base,easy,nonn
AUTHOR
Leroy Quet, Sep 17 2009
EXTENSIONS
Extended by Ray Chandler, Mar 13 2010
STATUS
approved