A131549 Least exponent k such that 3^k has exactly n consecutive 4's in its decimal representation.
5, 12, 55, 308, 510, 2340, 7286, 9670, 125406, 222961, 847169, 639226, 6250771, 14929721
Offset: 1
Examples
a(3)=55 because 3^55 (i.e., 174449211009120179071170507) is the smallest power of 3 to contain a run of 3 consecutive fours in its decimal form.
Programs
-
Mathematica
a = ""; Do[ a = StringJoin[a, "4"]; b = StringJoin[a, "4"]; k = 1; While[ StringPosition[ ToString[3^k], a] == {} || StringPosition[ ToString[3^k], b] != {}, k++ ]; Print[k], {n, 1, 10} ]
-
Python
def a(n): target, antitarget = '4'*n, '4'*(n+1) k, pow3 = 1, 3 while True: t = str(pow3) if target in t and antitarget not in t: return k k, pow3 = k+1, pow3*3 print([a(n) for n in range(1, 9)]) # Michael S. Branicky, May 12 2021
Extensions
a(11)-a(14) from Lars Blomberg, Feb 02 2013
Comments