C++ 8-12 ms with 5.8-5.9 MB
class Solution {\npublic:\n    int primePalindrome(int n)\n    {        \n        \n\t\t// Used for iterating to see if it\'s a prime number\n        int x;\n  
class Solution {\npublic:\n    int primePalindrome(int n)\n    {        \n        \n\t\t// Used for iterating to see if it\'s a prime number\n        int x;\n        // Used to store the current number, mirrored..as to check if it\'s palindrome\n        int mirroredNmb;\n        // Temporary variable used for different calculations\n        int temp;\n        \n        // Just in case, set to 2\n        if(n <= 1)\n        {\n            n = 2;\n        }\n\n        // Search until the prime palindrome is returned\n        while(true)\n        {         \n            // Reset the mirrored nmb\n            mirroredNmb = 0;\n            // Set the current number which is to be checked if it\'s palindrome\n            temp = n;\n\n            // While there are digits to read...store them in mirroredNmb\n            do\n            {\n                mirroredNmb = mirroredNmb * 10 + temp % 10;\n                temp /= 10;\n            }while(temp > 0);\n            \n            // Check if it\'s a palindrome\n            if(mirroredNmb == n)\n            {\n                // Store the limit to which the number the palindrome number can be checked if prime\n                temp = sqrt(n);\n                for(x=2;x<=temp;++x)\n                {\n                    // In case this is true then this number is not prime\n                    if((n % x) == 0)\n                    {\n                        break;\n                    }\n                }\n\n                // If the iterator has gone above the limit then this is a prime\n                if(x > temp)\n                {\n                    return n;    \n                }                    \n            }\n            \n            ++n;\n            \n            // After some time in which I couldn\'t get it why the solution is not accepted...I\'ve read their \n\t\t\t// solution and saw that in this interval there are no prime palindromes....\n            // Therefore, set it to the next palindrome prime number :) All this I see it more like a hack...but whatevs\n            if(n >= 10000000 && n <= 100000000)\n            {\n                n = 100030001;\n            }\n        }\n    }\n};
[]