login
A350518
a(n) is the least prime q such that q*(n+1)-n is the square of a prime.
2
5, 2, 3, 73, 5, 241, 2, 41, 13, 409, 3, 1321, 13, 113, 19, 601, 17, 73, 7, 41, 541, 97, 2, 409, 109, 97081, 7, 1033, 5, 3121, 31, 17, 313, 937, 11, 601, 37, 73, 43, 5881, 5, 20857, 13, 113, 409, 9241, 2, 193, 457, 89, 331, 17137, 53, 313, 31, 401, 61, 2113, 3, 3889, 61, 257, 571, 97, 29, 241321
OFFSET
1,1
LINKS
FORMULA
a(n)*(n+1)-n = A350517(n)^2.
EXAMPLE
a(4) = 73 because 73 is prime, 73*(4+1)-4 = 361 = 19^2 where 19 is prime, and no smaller prime than 73 works.
MAPLE
g:= proc(n) local p, M, a, m, q;
M:= sort(map(t -> rhs(op(t)), [msolve(p^2=1, n+1)]));
for a from 0 do
for m in M do
p:= a*(n+1)+m;
if not isprime(p) then next fi;
q:= (p^2+n)/(n+1);
if isprime(q) then return q fi
od od:
end proc:
map(g, [$1..100]);
MATHEMATICA
a[n_] := Module[{q = 2, p}, While[! IntegerQ[(p = Sqrt [q*(n + 1) - n])] || ! PrimeQ[p], q = NextPrime[q]]; q]; Array[a, 70] (* Amiram Eldar, Jan 03 2022 *)
PROG
(PARI) a(n) = my(q=2, p); while(! (issquare(q*(n+1)-n, &p) && isprime(p)), q = nextprime(q+1)); q; \\ Michel Marcus, Jan 03 2022
(Python)
from sympy import integer_nthroot, isprime, nextprime
def A350518(n):
q = 2
while True:
a, b = integer_nthroot(q*(n+1)-n, 2)
if b and isprime(a):
return q
q = nextprime(q) # Chai Wah Wu, Jan 04 2022
CROSSREFS
Cf. A350517.
Sequence in context: A291690 A073943 A193797 * A214662 A277581 A307381
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Jan 02 2022
STATUS
approved