cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Benjamin Knight, Oct 15 2018

Keywords

Comments

7 is the only fixed point less than 10.

Examples

			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.
		

Crossrefs

Cf. A090493.

Programs

  • 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 *)
  • 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
  • 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
    

Formula

a(n) = a(10*n).
a(n) <= A090493(n). - Rémy Sigrist, Oct 16 2018