login
A383593
In the binary expansion of n, change the most significant 0 bit to 1, if there is any 0 bit.
1
1, 1, 3, 3, 6, 7, 7, 7, 12, 13, 14, 15, 14, 15, 15, 15, 24, 25, 26, 27, 28, 29, 30, 31, 28, 29, 30, 31, 30, 31, 31, 31, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 56, 57, 58, 59, 60, 61, 62, 63, 60, 61, 62, 63, 62, 63, 63, 63, 96, 97, 98, 99, 100
OFFSET
0,3
COMMENTS
n = 0 is taken to be a single 0 bit, but for all other n no leading 0 bits are used.
The plot of the sequence is fractal.
LINKS
FORMULA
a(n) = n + floor(2^(A063250(n)-1)) for n > 0. - David Radcliffe, Jun 12 2025
EXAMPLE
a(25) = 29 since 25 = 11001_2 becomes 11101_2 = 29.
PROG
(Python)
def a(n): return int(bin(n)[2:].replace('0', '1', 1), 2)
print([a(n) for n in range(70)]) # Michael S. Branicky, Jun 11 2025
(Python)
def A383593(n): return (n if (t:=bin(n)[2:].find('0'))==-1 else n+(1<<n.bit_length()-t-1)) if n else 1 # Chai Wah Wu, Jun 17 2025
CROSSREFS
Cf. A000225 (fixed points), A004760 (range of values), A063250.
Sequence in context: A008867 A185958 A273062 * A269170 A003879 A376821
KEYWORD
nonn,base,easy,look
AUTHOR
STATUS
approved