OFFSET
1,1
COMMENTS
a(n) = 3 for n > 2 in A014224.
LINKS
Robert Israel, Table of n, a(n) for n = 1..1000
EXAMPLE
a(3) = 19 because 19 and 19^3 - 2 = 6857 are prime and no prime < 19 works.
MAPLE
f:= proc(n) local p;
p:= 1;
do
p:= nextprime(p);
if isprime(p^n-2) then return p fi
od
end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_] := Module[{p = 2}, While[!PrimeQ[p^n - 2], p = NextPrime[p]]; p]; Array[a, 100] (* Amiram Eldar, Aug 04 2022 *)
PROG
(Python)
from sympy import isprime, nextprime
def a(n):
p = 2
while not isprime(p**n - 2): p = nextprime(p)
return p
print([a(n) for n in range(1, 70)]) # Michael S. Branicky, Aug 04 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Aug 03 2022
STATUS
approved