OFFSET
1,2
COMMENTS
Does a(n) exist for all n? Some relatively large values: a(1021) = 67714, a(1111) = 64946. - Chai Wah Wu, Oct 07 2020
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
For n = 1, 1^(1/1) = 1.0000000, so a(1) is 0.
For n = 12, 12^(1/12) ~= 1.2300755, so a(12) = 0.
MATHEMATICA
max = 3000; a[n_] := SequencePosition[RealDigits[n^(1/n), 10, max][[1]], IntegerDigits[n]][[1, 1]] - 1; Array[a, 100] (* Amiram Eldar, Sep 25 2020 *)
PROG
(PARI) a(n) = {if (n==1, 0, my(p=10000); default(realprecision, p+1); my(x = floor(10^p*n^(1/n)), d = digits(x), nb = #Str(n)); for(k=1, #d-nb+1, my(v=vector(nb, i, d[k+i-1])); if (fromdigits(v) == n, return(k-1)); ); error("not found"); ); } \\ Michel Marcus, Sep 30 2020
(Python)
import gmpy2
from gmpy2 import mpfr, digits, root
gmpy2.get_context().precision=10**5
def A337840(n): # increase precision if -1 is returned
return digits(root(mpfr(n), n))[0].find(str(n)) # Chai Wah Wu, Oct 07 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
William Phoenix Marcum, Sep 25 2020
EXTENSIONS
More terms from Amiram Eldar, Sep 25 2020
STATUS
approved