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.

This page as a plain text file.
%I A383593 #34 Jun 18 2025 00:53:49
%S A383593 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,
%T A383593 29,30,31,30,31,31,31,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
%U A383593 56,57,58,59,60,61,62,63,60,61,62,63,62,63,63,63,96,97,98,99,100
%N A383593 In the binary expansion of n, change the most significant 0 bit to 1, if there is any 0 bit.
%C A383593 n = 0 is taken to be a single 0 bit, but for all other n no leading 0 bits are used.
%C A383593 The plot of the sequence is fractal.
%H A383593 Michael S. Branicky, <a href="/A383593/b383593.txt">Table of n, a(n) for n = 0..16383</a>
%F A383593 a(n) = n + floor(2^(A063250(n)-1)) for n > 0. - _David Radcliffe_, Jun 12 2025
%e A383593 a(25) = 29 since 25 = 11001_2 becomes 11101_2 = 29.
%o A383593 (Python)
%o A383593 def a(n): return int(bin(n)[2:].replace('0', '1', 1), 2)
%o A383593 print([a(n) for n in range(70)]) # _Michael S. Branicky_, Jun 11 2025
%o A383593 (Python)
%o A383593 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
%Y A383593 Cf. A000225 (fixed points), A004760 (range of values), A063250.
%K A383593 nonn,base,easy,look
%O A383593 0,3
%A A383593 _Frederik P.J. Vandecasteele_, Jun 11 2025