%I #15 May 19 2021 15:01:05
%S 1,65536,16777216,2199023255552,
%T 1684996666696914987166688442938726917102321526408785780068975640576
%N Smallest power of 2 with n repeated digits.
%C The subsequent terms are too large to display.
%C a(6) and a(7), 2^971 and 2^972, respectively, both of which have 293 digits; a(8), 2^8554, has 2576 digits. a(9), 2^42485, has 12790 digits.
%C Corresponding exponents of 2 are 0, 16, 24, 41, 220, 971, 972, 8554, 42485, 42486, 271979. [_Zak Seidov_, Oct 19 2010]
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Power_of_2">Power of 2</a>
%e a(1) is 1 because it is the first power of 2; all integers have at least one digit.
%e a(2) is 65536 because it is the first power of 2 with two of the same digit in a row.
%e a(3) is 16777216 because it is the first power of 2 with three of the same digit in a row.
%t f[n_] := Block[{k = 0}, While[ !MemberQ[Length /@ Split@ IntegerDigits[2^k], n], k++ ]; 2^k]; Table[f[n], {n, 5}] (* _Robert G. Wilson v_, Oct 21 2010 *)
%o (Python)
%o import math
%o for N in range(1, 10):
%o repdigits = 1
%o n = 0
%o while repdigits < N:
%o n += 1
%o s = str(2 ** n)
%o prev = ""
%o repdigits = maxrepdigits = 1
%o for d in s:
%o if d == prev: repdigits += 1
%o else:
%o maxrepdigits = max(maxrepdigits, repdigits)
%o repdigits = 1
%o prev = d
%o repdigits = max(maxrepdigits, repdigits)
%o print(N, 2 ** n)
%Y Subsequence of A000079 (powers of 2).
%Y Cf. A045875.
%K base,nonn
%O 1,2
%A _Grant Garcia_, Oct 18 2010, Oct 20 2010
|