%I #68 May 27 2020 12:01:05
%S 0,15,8,10,11,12,7,5,6,0,7,6,6,5,9,5,6,4,5,15,8,6,4,5,8,5,4,5,7,8,7,7,
%T 6,8,7,6,6,5,6,10,7,6,6,5,6,6,5,7,6,11,6,6,6,4,5,7,4,5,4,12,4,6,7,7,8,
%U 4,4,5,3,7,4,5,6,7,6,4,5,6,4,5,6,5,4,4,6,5,5,4,7,6,4,5,4,6,4,4,4,6
%N The smallest integer m such that each nonzero digit appears in the decimal representation of the sequence n^1, n^2, ..., n^x, where 1 <= x <= m, or 0 if no such m exists.
%C 7 is the only fixed point less than 10.
%F a(n) = a(10*n).
%F a(n) <= A090493(n). - _Rémy Sigrist_, Oct 16 2018
%e For n=1, a(1) = 0, because all powers are identical to 1, and it is not possible to get any other digits.
%e For n=3, a(3) = 8 because the following are needed to use all nonzero digits: 3^1 = 3, 3^2 = 9, 3^3 = 27, 3^4 = 81, 3^5 = 243, 3^8 = 6561.
%e For n=10, a(10) = 0, because one can only get digits 0 and 1.
%t a[n_] := If[IntegerQ[Log10[n]], 0, Module[{s={0}, m=1}, While[Length[s]<10, s=DeleteDuplicates@Catenate[{s,IntegerDigits[n^m]}]; m++]; m-1]]; Array[a,100] (* _Amiram Eldar_, Nov 14 2018 *)
%o (Python)
%o def A320572(n):
%o n = int(str(n).strip('0'))
%o if n != 1:
%o s = set(range(1, 10))
%o a = 0
%o m = 1
%o while s:
%o a += 1
%o m *= n
%o s.difference_update(int(z) for z in str(m))
%o return a
%o else:
%o return 0
%o (PARI) a(n) = {if (10^valuation(n, 10) == n, return(0)); v = []; kn = n; for (m=1, oo, v = Set(concat(v, digits(n))); v = select(x->(x>0), v); if (#v == 9, return (m)); n *= kn;);} \\ _Michel Marcus_, Oct 17 2018
%o (PARI) a(n) = {if(vecsum(digits(n))==1, return(0)); my(v = vector(9), todo = 9, t = n); for(i=1, oo, d=digits(t); for(j = 1, #d, if(d[j] > 0 && v[d[j]] == 0, todo--; v[d[j]] = 1; if(todo <= 0, return(i)))); t*=n)} \\ _David A. Corneth_, Oct 17 2018
%Y Cf. A090493.
%K nonn,base
%O 1,2
%A _Benjamin Knight_, Oct 15 2018
|