login
Least k such that 2^k has at least n consecutive 2's in its decimal representation.
7

%I #31 Sep 30 2024 18:40:39

%S 0,1,43,43,314,314,2354,8555,13326,81784,279272,865356,1727602,1727602

%N Least k such that 2^k has at least n consecutive 2'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)=43 because 2^43 (i.e. 8796093022208) is the smallest power of 2 to contain a run of 3 consecutive twos in its decimal form.

%t Table[k = 0; While[! SequenceCount[IntegerDigits[2^k], ConstantArray[2, n]] > 0, k++]; k, {n, 10}] (* _Robert Price_, May 17 2019 *)

%o (Python)

%o def A259089(n):

%o s, k, k2 = '2'*n, 0, 1

%o while True:

%o if s in str(k2):

%o return k

%o k += 1

%o k2 *= 2 # _Chai Wah Wu_, Jun 19 2015

%Y Cf. A006889, A131535, A131536, A063565, A259091, A259092.

%K more,nonn,base

%O 0,3

%A _N. J. A. Sloane_, Jun 18 2015

%E a(7)-a(13) from _Chai Wah Wu_, Jun 20 2015

%E Definition corrected by _Manfred Scheucher_, Jun 23 2015

%E a(0) prepended by _Chai Wah Wu_, Jan 28 2020