Emirpimes

Author

Eric W. Weisstein
August 18, 2004

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

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

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

Code

SemiprimeQ[1]:=False
SemiprimeQ[n_Integer]:=Plus@@(Last/@FactorInteger[n])==2

EmirpimesQ[p_Integer]:=Module[{l=IntegerDigits[p],r},
l=!=(r=Reverse[l])&&SemiprimeQ/@And@@{p,FromDigits[r]}
]

Enumeration

Length[l=Select[Range[10^6],EmirpimesQ]]//Timing

Length[l=Select[Range[10^7],EmirpimesQ]]//Timing

Length[l=Select[Range[10^8],EmirpimesQ]]//Timing

...runs out of memory...

Table[Count[l,_?(#<10^n&)],{n,7}]

Binary Plot

<<Utilities`Plot`

Show[PixelPerfect[NaryPlot[Select[Range[5000],EmirpimesQ]],BlockSize->2]]