optimize prime palindromes