Dihedral Prime

Author

Eric W. Weisstein
January 21, 2009

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

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

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

Count

FlipH[l_]:=Reverse[l]/.{2->5,5->2}
FlipV[l_]:=l/.{2->5,5->2}
FlipHV[l_]:=Reverse[l]

(l=Select[Prime[Range[10^5]],(Complement[d=IntegerDigits[#],{0,1,2,5,8}]==={}&&PrimeQ/@FromDigits/@(FlipH[d]&&FlipV[d]&&FlipHV[d]))&]
)//Timing