Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #19 Nov 22 2014 18:41:23
%S 3,4,6,6,90,4,6,30,6,180,6,12,30,18,12,48,60,90,24,30,18,120,12,510,
%T 10,60,36,12,60,12,12,30,12,12,30,120,24,48,18,48,690,1020,30,14,18,
%U 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
%N Least number m such that both m^2 -/+ prime(n) are (positive) primes.
%H Zak Seidov, <a href="/A248738/b248738.txt">Table of n, a(n) for n = 1..10000</a>
%e a(1)=3 because p=prime(1)=2 and both P=3^2-2=7 and Q=3^2+2=11 are prime;
%e a(3)=6 because p=5 and both P=31 and Q=41 are prime;
%e a(10000)=510 because p=104729 and both P=155371 and Q=364829 are prime.
%t 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 *)
%o (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
%Y Cf. A108701, A153975, A176681, A176682, A176683, A177833.
%K nonn
%O 1,1
%A _Zak Seidov_, Oct 13 2014