OFFSET
0,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
EXAMPLE
a(2) = a(7) = a(27) = 3 because 3^3 = 27.
MATHEMATICA
a = {}; Do[k = 1; While[ StringPosition[ ToString[3^k], ToString[n] ] == {}, k++ ]; a = Append[a, k], {n, 0, 50} ]; a
sp3[n_]:=Module[{idn=IntegerDigits[n], t=1}, While[!MemberQ[Partition[ IntegerDigits[ 3^t], Length[idn], 1], idn], t++]; t]; Array[sp3, 60, 0] (* Harvey P. Dale, Oct 29 2013 *)
PROG
(Python)
def a(n):
s, k = str(n), 1
while s not in str(3**k): k += 1
return k
print([a(n) for n in range(70)]) # Michael S. Branicky, Oct 04 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Aug 10 2001
STATUS
approved