login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A356330
a(n) is the least prime p such that p^n-2 is prime.
1
5, 2, 19, 3, 3, 3, 7, 7, 3, 53, 1171, 7, 19, 5, 7, 73, 31, 61, 19, 19, 31, 3, 19, 17, 349, 5, 499, 7, 1021, 17, 7, 491, 823, 463, 1171, 59, 3, 19, 199, 179, 3, 29, 1609, 463, 373, 379, 2539, 439, 349, 5, 1051, 241, 439, 467, 61, 89, 433, 563, 139, 499, 139, 607, 409, 1607, 433, 1423, 2719, 7933, 31
OFFSET
1,1
COMMENTS
a(n) = 3 for n > 2 in A014224.
LINKS
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
Cf. A014224.
Sequence in context: A286154 A367288 A304635 * A306198 A327316 A206582
KEYWORD
nonn
AUTHOR
Robert Israel, Aug 03 2022
STATUS
approved