login
Numbers n such that both n+(n-1)^2 and n+(n+1)^2 are primes.
1

%I #9 Feb 09 2017 06:11:58

%S 2,3,4,7,9,15,18,25,34,55,58,63,67,100,102,139,144,148,154,162,163,

%T 168,190,195,219,232,247,267,280,289,330,349,379,384,417,427,448,454,

%U 477,568,580,643,645,669,672,727,762,793,802,813,837,847,900,975,988,993

%N Numbers n such that both n+(n-1)^2 and n+(n+1)^2 are primes.

%H Ivan Neretin, <a href="/A108809/b108809.txt">Table of n, a(n) for n = 1..10000</a>

%e 34 is in the sequence because 34 + 33^2 = 1123 and 34 + 35^2 = 1259 are both prime.

%p L:=[]; for k from 1 to 1000 do if isprime(k+(k-1)^2) and isprime(k+(k+1)^2) then L:=[op(L),k] fi od;

%t Select[Range@1000, PrimeQ[#^2 - # + 1] && PrimeQ[#^2 + 3 # + 1] &] (* _Ivan Neretin_, Feb 08 2017 *)

%o (PARI) isok(n) = isprime(n+(n-1)^2) && isprime(n+(n+1)^2); \\ _Michel Marcus_, Feb 08 2017

%Y Cf. A027861.

%Y Intersection of A055494 and A094210. - _Michel Marcus_, Feb 08 2017

%K easy,nonn

%O 1,1

%A _Walter Kehowski_, Jul 04 2005