login

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”).

Primes prime(n) such that at least one of the two numbers (prime(n+2)^2-prime(n)^2)/2 - 1 and (prime(n+2)^2-prime(n)^2)/2 + 1 is prime.
8

%I #10 Jun 28 2020 19:21:20

%S 3,5,7,11,13,19,29,31,37,41,43,53,59,61,67,71,79,83,97,107,127,139,

%T 149,157,179,181,191,197,227,229,239,251,263,283,293,307,347,349,353,

%U 373,419,439,443,463,467,479,499,523,541,569,601,607,613,617,619

%N Primes prime(n) such that at least one of the two numbers (prime(n+2)^2-prime(n)^2)/2 - 1 and (prime(n+2)^2-prime(n)^2)/2 + 1 is prime.

%H Robert Israel, <a href="/A130761/b130761.txt">Table of n, a(n) for n = 1..10000</a>

%e (7^2 - 3^2)/2 - 1 is 19. Therefore 3 is in the sequence.

%e (19^2 - 13^2)/2 + 1 is 97. Hence 13 is in the sequence.

%p Res:= NULL:

%p p:= 5: q:= 3:

%p count:= 0:

%p while count < 100 do

%p r:= q; q:= p; p:= nextprime(p);

%p v:= (p^2-r^2)/2;

%p if isprime(v+1) or isprime(v-1) then

%p count:= count+1; Res:= Res, r;

%p fi

%p od:

%p Res; # _Robert Israel_, Oct 03 2018

%t Prime[Select[Range[140], PrimeQ[(Prime[ #+2]^2-Prime[ # ]^2)/2+1] || PrimeQ[(Prime[ # +2]^2-Prime[ # ]^2)/2-1] &]]

%t Select[Partition[Prime[Range[200]],3,1],AnyTrue[(#[[3]]^2-#[[1]]^2)/2+{1,-1},PrimeQ]&][[All,1]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jun 28 2020 *)

%K nonn,less

%O 1,1

%A _J. M. Bergot_, Jul 13 2007

%E Edited and extended by _Stefan Steinerberger_, Jul 23 2007