brute force | naive | clean simple code | c++
Note\n\nif n=9989900, output is 100030001\nif n=100000000(10^8), output is 100030001\nConstraints:\n1 <= n <= 10^8\n\n# Code\ncpp []\nclass Solution {\npublic:\
# Note\n```\nif n=9989900, output is 100030001\nif n=100000000(10^8), output is 100030001\nConstraints:\n1 <= n <= 10^8\n```\n# Code\n```cpp []\nclass Solution {\npublic:\n    bool isPrime(int n){\n        if(n==1) return false;\n        if(n==2 or n==3) return true;\n        if(n%2==0 or n%3==0) return false;\n        for(int i=5;i<=sqrt(n);i+=6){\n            if(n%i==0 or n%(i+2)==0) return false;\n        }\n        return true;\n    }\n    bool isPal(int n){\n        string s = to_string(n);\n\n        int i=0,j=s.length()-1;\n        while(i<j){\n            if(s[i]!=s[j]) return false;\n            i++;\n            j--;\n        }\n        return true;\n    }\n    \n    int primePalindrome(int n) {\n        if(n >= 9989900) return 100030001;\n        \n        for(int i=n;i<=2e8;i++){\n            if(isPal(i) and isPrime(i)) return i;\n        }\n        return -1;\n    }\n};\n```
['Math', 'Number Theory', 'C++']