|
|
A350517
|
|
a(n) is the least prime p such that p^2+n = q*(n+1) for some prime q.
|
|
2
|
|
|
3, 2, 3, 19, 5, 41, 3, 19, 11, 67, 5, 131, 13, 41, 17, 101, 17, 37, 11, 29, 109, 47, 5, 101, 53, 1619, 13, 173, 11, 311, 31, 23, 103, 181, 19, 149, 37, 53, 41, 491, 13, 947, 23, 71, 137, 659, 7, 97, 151, 67, 131, 953, 53, 131, 41, 151, 59, 353, 11, 487, 61, 127, 191, 79, 43, 4021, 67, 139, 29
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
a(n) >= sqrt(n+2), with equality if and only if n+2 is the square of a prime.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(4) = 19 because 19 is prime and 19^2+4 = 365 = 73*(4+1) where 73 is prime, and no smaller prime than 19 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 p fi
od od:
end proc:
map(g, [$1..100]);
|
|
MATHEMATICA
|
a[n_] := Module[{p = NextPrime[Floor[Sqrt[n + 2]] - 1], q}, While[! IntegerQ [(q = (p^2 + n)/(n + 1))] || ! PrimeQ[q], p = NextPrime[p]]; p]; Array[a, 70] (* Amiram Eldar, Jan 03 2022 *)
|
|
PROG
|
(PARI) isp(r) = (denominator(r)==1) && isprime(r);
a(n) = my(p=2); while (!isp((p^2+n)/(n+1)), p = nextprime(p+1)); p; \\ Michel Marcus, Jan 03 2022
(Python)
from sympy import isprime, nextprime
p = 2
while True:
a, b = divmod(p**2+n, n+1)
if not b and isprime(a):
return p
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|