OFFSET
1,2
COMMENTS
2*3=6;3-2=1;6+-1->primes, 3*5=15;5-3=2;15+-2->primes, 2*5=10;5-2=3;10+-3->primes, 7*11=77;11-7=6;77+-6->primes, 22=2*11;11-2=9;22+-9->primes,..
MATHEMATICA
lst={}; Do[pa=Prime[a]; Do[pb=Prime[b]; sp=pa*pb; dp=Abs[pa-pb]; If[PrimeQ[sp-dp]&&PrimeQ[sp+dp], AppendTo[lst, dp]], {b, a+1, 3*6!}], {a, 3*6!}]; Take[Union@lst, 120]
d2dQ[{a_, b_}]:=Module[{c=b-a}, AllTrue[a*b+{c, -c}, PrimeQ]]; With[ {nn= 100}, Take[#[[2]]-#[[1]]&/@Select[Union[Sort/@Tuples[ Prime[ Range[ 3nn]], 2]], d2dQ]//Union, nn]] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Aug 11 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Mar 31 2010
STATUS
approved