login
A176763
Smallest power of 3 whose decimal expansion contains n.
12
59049, 1, 27, 3, 243, 6561, 6561, 27, 81, 9, 10460353203, 1162261467, 129140163, 31381059609, 177147, 1594323, 129140163, 177147, 2187, 19683, 387420489, 2187, 1162261467, 1594323, 243, 2541865828329, 1162261467, 27, 282429536481, 729, 43046721, 531441, 1594323
OFFSET
0,1
COMMENTS
This is to 3 as A030001 is to 2.
FORMULA
a(n) = MIN{A000244(i) such that n in decimal representation is a substring of A000244(i)}.
EXAMPLE
a(1) = 1 because 3^0 = 1 has "1" as a substring (not a proper substring, though).
a(2) = 27 because 3^3 = 27 has "2" as a substring.
a(10) = 10460353203 because 3^21 = 10460353203 is the smallest power of 3 whose decimal expansion contains "10" (in this case, "10" happens to be the left-hand or initial digits, but that is not generally true).
MATHEMATICA
A176763[n_] := Block[{k = -1}, While[StringFreeQ[IntegerString[3^++k], IntegerString[n]]]; 3^k]; Array[A176763, 50, 0] (* Paolo Xausa, Apr 03 2024 *)
PROG
(Python)
def a(n):
k, strn = 0, str(n)
while strn not in str(3**k): k += 1
return 3**k
print([a(n) for n in range(33)]) # Michael S. Branicky, Apr 03 2024
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Jonathan Vos Post, Apr 25 2010
EXTENSIONS
More terms from Sean A. Irvine and Jon E. Schoenfield, May 05 2010
a(0) prepended by Paolo Xausa, Apr 03 2024
STATUS
approved