I need to efficiently identify Emirps - primes that stay prime when digits are reversed (like 13 becoming 31).
My current algorithm takes known primes and tests if their reverses are also prime using Miller-Rabin. I've added two filters: skip primes starting with even digits or 5, since their reverses would be composite.
What other mathematical shortcuts can I use to eliminate candidates without running the full primality test? I'm particularly interested in digit patterns or number theory properties that guarantee a reversed number will be composite.
Since I already know the input numbers are prime, are there any special optimizations for testing whether their reverses are prime?
Any suggestions for making this more efficient would be helpful.