login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A063566
3^a(n) = smallest positive power of 3 having n in its decimal representation.
4
10, 4, 3, 1, 5, 8, 8, 3, 4, 2, 21, 19, 17, 22, 11, 13, 17, 11, 7, 9, 18, 7, 19, 13, 5, 26, 19, 3, 24, 6, 16, 12, 13, 31, 15, 21, 24, 29, 18, 31, 17, 12, 18, 5, 12, 28, 16, 11, 15, 10, 35, 32, 33, 12, 26, 27, 8, 40, 26, 10, 21, 8, 19, 17, 24, 8, 33, 16, 9, 14
OFFSET
0,1
LINKS
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
Essentially the same as A062520.
Cf. A000244.
Sequence in context: A065194 A113315 A081986 * A153690 A018811 A309707
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Aug 10 2001
STATUS
approved