login
A248738
Least number m such that both m^2 -/+ prime(n) are (positive) primes.
1
3, 4, 6, 6, 90, 4, 6, 30, 6, 180, 6, 12, 30, 18, 12, 48, 60, 90, 24, 30, 18, 120, 12, 510, 10, 60, 36, 12, 60, 12, 12, 30, 12, 12, 30, 120, 24, 48, 18, 48, 690, 1020, 30, 14, 18, 420, 180, 18, 36, 540, 42, 1230, 150, 870, 36, 18, 330, 870, 18, 30, 18, 18, 18, 150, 30, 18, 30, 30, 60, 180, 24, 30, 36
OFFSET
1,1
EXAMPLE
a(1)=3 because p=prime(1)=2 and both P=3^2-2=7 and Q=3^2+2=11 are prime;
a(3)=6 because p=5 and both P=31 and Q=41 are prime;
a(10000)=510 because p=104729 and both P=155371 and Q=364829 are prime.
MATHEMATICA
lnm[n_]:=Module[{m=2, pr=Prime[n]}, If[m^2-pr<0, m=Ceiling[Sqrt[pr]]]; While[ !AllTrue[m^2+{pr, -pr}, PrimeQ], m++]; m]; Array[lnm, 80] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Nov 22 2014 *)
PROG
(PARI) a(n) = { p = prime(n); m = sqrtint(p); until( isprime(m^2-p) && isprime(m^2+p), m++); m} \\ Michel Marcus, Oct 13 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 13 2014
STATUS
approved