%I #15 May 04 2021 18:16:37
%S 5,2,3,6,5,4,4,3,2,1,11,15,18,11,6,18,17,19,13,23,9,8,14,21,12,13,26,
%T 28,12,3,8,6,13,24,10,18,12,27,9,27,10,6,9,8,6,14,8,7,9,5,18,16,18,6,
%U 13,35,4,20,13,5,11,4,23,18,12,4,17,8,24,7,22,17,3
%N Smallest power of 9 having n in its decimal representation.
%C Variant of A062526. - _R. J. Mathar_, Dec 15 2008
%t a = {}; Do[k = 1; While[ StringPosition[ ToString[9^k], ToString[n] ] == {}, k++ ]; a = Append[a, k], {n, 0, 60} ]; a
%o (Python)
%o def a(n):
%o target, k, pow9 = str(n), 1, 9
%o while not target in str(pow9): k, pow9 = k+1, pow9*9
%o return k
%o print([a(n) for n in range(73)]) # _Michael S. Branicky_, May 02 2021
%K nonn,base
%O 0,1
%A _Robert G. Wilson v_, Aug 10 2001
%E More terms from _Michael S. Branicky_, May 02 2021
|