cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A383593 In the binary expansion of n, change the most significant 0 bit to 1, if there is any 0 bit.

Original entry on oeis.org

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

Views

Author

Keywords

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.

Examples

			a(25) = 29 since 25 = 11001_2 becomes 11101_2 = 29.
		

Crossrefs

Cf. A000225 (fixed points), A004760 (range of values), A063250.

Programs

  • 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<Chai Wah Wu, Jun 17 2025

Formula

a(n) = n + floor(2^(A063250(n)-1)) for n > 0. - David Radcliffe, Jun 12 2025