login
A320572
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.
1
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, 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, 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
OFFSET
1,2
COMMENTS
7 is the only fixed point less than 10.
FORMULA
a(n) = a(10*n).
a(n) <= A090493(n). - Rémy Sigrist, Oct 16 2018
EXAMPLE
For n=1, a(1) = 0, because all powers are identical to 1, and it is not possible to get any other digits.
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.
For n=10, a(10) = 0, because one can only get digits 0 and 1.
MATHEMATICA
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 *)
PROG
(Python)
def A320572(n):
n = int(str(n).strip('0'))
if n != 1:
s = set(range(1, 10))
a = 0
m = 1
while s:
a += 1
m *= n
s.difference_update(int(z) for z in str(m))
return a
else:
return 0
(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
(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
CROSSREFS
Cf. A090493.
Sequence in context: A103241 A194707 A094501 * A090636 A126892 A195035
KEYWORD
nonn,base
AUTHOR
Benjamin Knight, Oct 15 2018
STATUS
approved