login
Numbers n such that 2*prime(n) - prime(n+1) is a square.
2

%I #12 Mar 02 2020 16:25:30

%S 1,2,5,6,11,24,49,50,73,87,182,183,202,203,307,309,379,458,459,520,

%T 677,961,1001,1475,1618,1619,1769,2089,2427,2428,3303,3378,4090,4397,

%U 4944,5444,5969,6496,6497,7653,8557,8871,8873,9091,9526,10524,11580,11824

%N Numbers n such that 2*prime(n) - prime(n+1) is a square.

%H Robert Israel, <a href="/A110975/b110975.txt">Table of n, a(n) for n = 1..1000</a>

%p Res:= NULL: p:= 2; count:= 0:

%p for n from 1 while count < 100 do

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

%p if issqr(2*q-p) then count:= count+1; Res:= Res, n; fi

%p od:

%p Res; # _Robert Israel_, Mar 02 2020

%t Select[Range[12000], IntegerQ[(2Prime[ # ] - Prime[ # + 1])^(1/2)] &] (* _Ray Chandler_, Oct 07 2005 *)

%t Position[2#[[1]]-#[[2]]&/@Partition[Prime[Range[12000]],2,1],_?(IntegerQ[ Sqrt[#]]&)]//Flatten (* _Harvey P. Dale_, Apr 30 2019 *)

%Y Cf. A110970.

%K nonn

%O 1,2

%A _Giovanni Teofilatto_, Sep 28 2005

%E Corrected and extended by _Ray Chandler_, Oct 07 2005