A131535 Exponent of least power of 2 having exactly n consecutive 1's in its decimal representation.
1, 0, 40, 42, 313, 485, 1841, 8923, 8554, 81783, 165742, 1371683, 1727601, 9386566, 28190643, 63416789
Offset: 0
Examples
a(3)=42 because 2^42(i.e. 4398046511104) is the smallest power of 2 to contain a run of 3 consecutive ones in its decimal form.
Links
- Popular Computing (Calabasas, CA), Two Tables, Vol. 1, (No. 9, Dec 1973), page PC9-16.
Programs
-
Mathematica
a = ""; Do[ a = StringJoin[a, "1"]; b = StringJoin[a, "1"]; k = 1; While[ StringPosition[ ToString[2^k], a] == {} || StringPosition[ ToString[2^k], b] != {}, k++ ]; Print[k], {n, 1, 10} ]
-
Python
def A131535(n): s, t, m, k, u = '1'*n, '1'*(n+1), 0, 1, '1' while s not in u or t in u: m += 1 k *= 2 u = str(k) return m # Chai Wah Wu, Jan 28 2020
Extensions
2 more terms from Sean A. Irvine, Jul 19 2010
a(13)-a(14) from Lars Blomberg, Jan 24 2013
a(15) from Bert Dobbelaere, Feb 25 2019
a(0) added and a(1) corrected by Chai Wah Wu, Jan 28 2020