Sexy Primes

Author

Eric W. Weisstein
November 7, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/SexyPrimes.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/SexyPrimes.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Initialization

Pairs

pairs={#,#+6}&/@Select[Prime[Range[100]],PrimeQ[#+6]&]

Record

Digits[p=(48011837012*((53238*Primorial[7879])^2-1)+2310)*53238*Primorial[7879]/385+1]

PrimeQ/@{p,p+6}//Timing

Triples

Append[#,#[[1]]+12]&/@Select[pairs,PrimeQ[#[[1]]+12]&&!PrimeQ[#[[1]]+18]&]

Record

Digits[p=(61310346529*205881*Primorial[4001]*(205881*Primorial[4001]+1)+210)*(205881*Primorial[4001]-1)/35+1]

PrimeQ/@{p,p+6,p+12,p+18}//Timing

Quadruplets

Append[#,#[[1]]+12]&/@Select[pairs,PrimeQ[#[[1]]+12]&&!PrimeQ[#[[1]]+18]&]

Record

Digits[p=411784973*Primorial[2347]+3301]

PrimeQ/@{p,p+6,p+12,p+18,p+24,p+30}//Timing