login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A062520 3^a(n) is smallest nonnegative power of 3 containing n. 2
10, 0, 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, 35, 11, 6, 29, 18, 47 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
EXAMPLE
a(1) = 0 since 3^0 = 1. a(2) = a(7) = a(27) = 3 because 3^3 = 27.
MAPLE
N:= 99:
count:= 1: A["0"]:= 10:
for n from 0 while count <= N do
S:= convert(3^n, string); nS:= length(S);
for m from 1 to 2 while count <= N do
for i from 1 to nS+1-m while count <= N do
if S[i] <> "0" and not assigned(A[S[i..i+m-1]]) then
count:= count+1; A[S[i..i+m-1]]:= n;
fi
od
od
od:
seq(A[convert(n, string)], n=0..N); # Robert Israel, Jun 14 2018
MATHEMATICA
Table[k = 0; While[ StringPosition[ ToString[3^k], ToString[n] ] == {}, k++ ]; k, {n, 0, 75} ]
PROG
(Python)
def a(n):
s, k = str(n), 0
while s not in str(3**k): k += 1
return k
print([a(n) for n in range(76)]) # Michael S. Branicky, Oct 04 2021
CROSSREFS
Cf. A030000. Essentially the same as A063566. Cf. A000244.
Sequence in context: A291451 A323836 A365893 * A157962 A063741 A320227
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Jun 24 2001
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 10:11 EDT 2024. Contains 371935 sequences. (Running on oeis4.)