%I #22 Jul 20 2024 20:11:19
%S 1,0,40,42,313,485,1841,8923,8554,81783,165742,1371683,1727601,
%T 9386566,28190643,63416789
%N Exponent of least power of 2 having exactly n consecutive 1's in its decimal representation.
%H Popular Computing (Calabasas, CA), <a href="/A094776/a094776.jpg">Two Tables</a>, Vol. 1, (No. 9, Dec 1973), page PC9-16.
%e 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.
%t 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} ]
%o (Python)
%o def A131535(n):
%o s, t, m, k, u = '1'*n, '1'*(n+1), 0, 1, '1'
%o while s not in u or t in u:
%o m += 1
%o k *= 2
%o u = str(k)
%o return m # _Chai Wah Wu_, Jan 28 2020
%Y Cf. A006889, A131535, A131536, A259089, A063565, A259091, A259092.
%K more,nonn,base
%O 0,3
%A _Shyam Sunder Gupta_, Aug 26 2007
%E 2 more terms from _Sean A. Irvine_, Jul 19 2010
%E a(13)-a(14) from _Lars Blomberg_, Jan 24 2013
%E a(15) from _Bert Dobbelaere_, Feb 25 2019
%E a(0) added and a(1) corrected by _Chai Wah Wu_, Jan 28 2020