OFFSET
1,1
COMMENTS
a(n) always exists since there are (infinitely many) primes p congruent to 1 modulo n.
Conjecture: a(n) <= (n+5)*(n-1) for all n > 1 (verified for n <= 12000).
LINKS
Zhi-Wei Sun, Table of n, a(n) for n = 1..4000
EXAMPLE
a(1) = 3 since 3*1 + 1 = 2^2 and 2 is prime.
a(2) = 4 since 4*2 + 1 = 3^2 and 3 is prime.
a(13) = 216 = (13+5)*(13-1) since 216*13 + 1 = 53^2 and 53 is prime.
MATHEMATICA
PQ[n_]:=PQ[n]=PrimeQ[Sqrt[n]];
tab={}; Do[m=1; Label[bb]; If[PQ[m*n+1], tab=Append[tab, m]; Goto[aa]];
m=m+1; Goto[bb]; Label[aa], {n, 1, 70}]; Print[tab]
PROG
(PARI) a(n) = my(m=1); while (isprimepower(m*n+1) != 2, m++); m; \\ Michel Marcus, Nov 02 2025
(Python)
from math import isqrt
from sympy import isprime
from itertools import count
def a(n): return next(m for m in count(1) if (p:=isqrt(q:=m*n+1))**2==q and isprime(p))
print([a(n) for n in range(1, 71)]) # Michael S. Branicky, Nov 02 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Zhi-Wei Sun, Oct 25 2025
STATUS
approved
