OFFSET
0,5
COMMENTS
Upon the observation that 7^2 - 5^2 = 49 - 25 = 24 = 4!, it is natural to ask whether there are primes p, q such that q^2 - p^2 = n! for all n >= 4.
If d1 * d2 = n! = q^2 - p^2 = (q + p) * (q - p) then we can set d1 = (q - p) and d2 = (q + p). Solving for p and q in terms of d1 and d2 gives p = abs((d1 - d2) / 2) and q = (d1 + d2)/2. As p and q are prime we must have gcd(d1, d2) = 2. - David A. Corneth, Apr 04 2026
LINKS
David A. Corneth, PARI program
EXAMPLE
See A394631.
PROG
(PARI) apply( {A394632(n, f=n!)=n>3&&forprime(p=3, oo, issquare(p^2+f, &q)&& isprime(q)&& return(q))}, [0..16]) /* For illustration, slow for n > 20. Better use: */
(PARI) \\ See Corneth link
(PARI) a(n)=if(n<4, return(0)); my(N=n!, L=List()); fordiv(vecprod(primes([3, n])), d, my(U=2*gcd(d^n, N)); my(p=(N/U+U)/2, q=abs(N/U-U)/2); if(ispseudoprime(q)&&ispseudoprime(p), listput(L, [p, q]))); vecsort(Vec(L))[1][1]; \\ Daniel Suteu, Apr 10 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Apr 04 2026
EXTENSIONS
More terms from David A. Corneth, Apr 04 2026
STATUS
approved
