OFFSET
1,1
COMMENTS
a(n) always exists. Let p be a prime other than 2 or 5, and m its length in base 10. Let r be the multiplicative order of p mod 10^m. Then p^k ends in p if and only if k-1 is a multiple of r. p^(j*r+1) starts with p if and only if for some integer s, s + log_10(p)) <= (j*r+1)*log_10(p) < s + frac(log_10(p+1)). This is true for some j because r*log_10(p) is irrational and the fractional parts of the multiples of an irrational number are dense in [0,1]. - Robert Israel, Dec 12 2018
If all integers are considered instead of only primes, not all of them can satisfy the requirement. For instance see A075823 for two digits numbers.
Record values beyond 10^5 are: a(51) = 138801, a(74) = 193701, a(88) = 1766101. Also, a(98) = 282076 and a(100) = 438501 would be record values if not preceded by a(88). - M. F. Hasler, Dec 14 2018
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..100
Carlos Rivera, Puzzle 934. The prime 7499, The Prime Puzzles and Problems Connection.
Carlos Rivera, Conjecture 81, The Prime Puzzles and Problems Connection.
EXAMPLE
2^21 = 2097152 and 21 is the least exponent;
3^41 = 36472996377170786403 and 41 is the least exponent.
MAPLE
with(numtheory): P:=proc(q) local a, b, c, h, n, t, x;
for n from 1 to q do c:=ithprime(n); b:=ilog10(c)+1;
x:=1; if c mod 10=3 or c mod 10=7 then x:=4;
else if c mod 10=9 then x:=2; fi; fi;
for h from x+1 by x to q do t:=c^h; a:=op(evalf(t))[1];
if c=t mod 10^b then if c=trunc(a/10^(ilog10(a)-b+1))
then print(h); break; fi; fi; od; od; end: P(10^6);
# Alternative:
f:= proc(n) local p, k, m, q, r;
p:= ithprime(n);
m:= ilog10(p)+1;
q:= numtheory:-order(p, 10^m);
for k from q+1 by q do
r:= p^k;
if p = floor(r/10^(ilog10(r)+1-m))
then return k
fi;
od
end proc:
f(1):= 21: f(3):= 24:
map(f, [$1..50]); # Robert Israel, Dec 12 2018
MATHEMATICA
a[p_] := Module[{d=IntegerDigits[p]}, nd=Length[d]; k=2; While[IntegerDigits[p^k][[1;; nd]] != d || IntegerDigits[p^k][[-nd;; -1]] != d, k++]; k]; a/@Prime@Range@10 (* Amiram Eldar, Dec 10 2018 *)
PROG
(PARI) isokd(d, dpk) = {for (i=1, #d, if (dpk[i] != d[i], return (0)); ); return (1); }
isok(p, k) = {my(dpk=digits(p^k), d = digits(p)); if (!isokd(d, dpk), return (0)); isokd(Vecrev(d), Vecrev(dpk)); }
a(n) = {my(k=2, p = prime(n)); while (!isok(p, k), k++); k; } \\ Michel Marcus, Dec 10 2018
(PARI) apply( {A320775(n, d=logint(n=prime(n), 10)+1, K=if(n>5||n==3, znorder(Mod(n, 10^d)), n+18), f(x)=x\10^(logint(x, 10)+1-d))=forstep(k=1+K, oo, K, n==f(n^k)&&return(k))}, [1..20]) \\ Define A320775 & test it via apply(). - M. F. Hasler, Dec 10 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Dec 03 2018
STATUS
approved