login
a(n) is the smallest positive integer m with exactly n ones in its binary representation and with n represented in binary as a substring of the binary representation of m.
3

%I #10 Feb 18 2023 14:25:13

%S 1,5,7,39,47,111,127,1151,1279,2815,3071,13311,14335,30719,32767,

%T 557055,589823,1245183,1310719,5505023,5767167,12058623,12582911,

%U 104857599,109051903,226492415,234881023,973078527,1006632959,2080374783,2147483647,70866960383

%N a(n) is the smallest positive integer m with exactly n ones in its binary representation and with n represented in binary as a substring of the binary representation of m.

%C a(3320) has 1001 digits. - _Michael S. Branicky_, Feb 18 2023

%H Michael S. Branicky, <a href="/A147760/b147760.txt">Table of n, a(n) for n = 1..3319</a>

%F a(n) = n*2^m + 2^m - 1 where m = n - A000120(n). - _Michael S. Branicky_, Feb 18 2023

%e 6 represented in binary is 110. 111 (decimal) represented in binary is 1101111, which contains exactly six 1's and 110 as a substring ({110}1111). Since 111 is the smallest positive integer that satisfies the conditions, then a(6) = 111.

%o (Python)

%o def a(n): b = bin(n)[2:]; m = n - b.count("1"); return (n<<m) + (1<<m) - 1

%o print([a(n) for n in range(1, 33)]) # _Michael S. Branicky_, Feb 18 2023

%Y Cf. A000120, A147761, A147762.

%K base,nonn

%O 1,2

%A _Leroy Quet_, Nov 11 2008

%E Extended by _Ray Chandler_, Nov 15 2008

%E a(31) and beyond from _Michael S. Branicky_, Feb 18 2023