A176763 Smallest power of 3 whose decimal expansion contains n.
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
Examples
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).
Links
- Paolo Xausa, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
A176763[n_] := Block[{k = -1}, While[StringFreeQ[IntegerString[3^++k], IntegerString[n]]]; 3^k]; Array[A176763, 50, 0] (* Paolo Xausa, Apr 03 2024 *)
-
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
Extensions
More terms from Sean A. Irvine and Jon E. Schoenfield, May 05 2010
a(0) prepended by Paolo Xausa, Apr 03 2024
Comments