login
A390118
Least positive integer m such that m*n + 1 = p^2 for some prime number p.
1
3, 4, 1, 2, 24, 4, 24, 1, 32, 12, 48, 2, 216, 12, 8, 3, 264, 16, 72, 6, 8, 24, 96, 1, 408, 108, 104, 6, 120, 4, 120, 9, 16, 132, 24, 8, 144, 36, 72, 3, 168, 4, 696, 12, 8, 48, 1680, 1, 192, 204, 88, 54, 216, 52, 144, 3, 24, 60, 2112, 2, 2208, 60, 80, 15, 96, 8, 1080, 66, 32, 12
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).
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