A175924 Smallest power of 2 with n repeated digits.
1, 65536, 16777216, 2199023255552, 1684996666696914987166688442938726917102321526408785780068975640576
Offset: 1
Examples
a(1) is 1 because it is the first power of 2; all integers have at least one digit. a(2) is 65536 because it is the first power of 2 with two of the same digit in a row. a(3) is 16777216 because it is the first power of 2 with three of the same digit in a row.
Links
- Wikipedia, Power of 2
Programs
-
Mathematica
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 *)
-
Python
import math for N in range(1, 10): repdigits = 1 n = 0 while repdigits < N: n += 1 s = str(2 ** n) prev = "" repdigits = maxrepdigits = 1 for d in s: if d == prev: repdigits += 1 else: maxrepdigits = max(maxrepdigits, repdigits) repdigits = 1 prev = d repdigits = max(maxrepdigits, repdigits) print(N, 2 ** n)
Comments