EasyTOGO || CheckItout || palPrime
\n\n\n# Complexity\n- Time complexity: O((log10(n) + sqrt(n)) * T), where T is the number of iterations of the while loop. \n Add your time complexity here, e.g
![image.png](https://assets.leetcode.com/users/images/bd664eba-bb72-43c5-937d-fbae5037aca7_1723900491.362038.png)\n\n\n# Complexity\n- Time complexity: O((log10(n) + sqrt(n)) * T), where T is the number of iterations of the while loop. \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public boolean checkPrime(int n){\n        int c = 0;\n\n        for(int i=1;i<=Math.sqrt(n);i++){\n            if(n%i==0){\n                if(i==n/i){\n                    c+=1;\n                }\n                else if(i!=n/i){\n                    c+=2;\n                }\n            }\n        }\n        if(c==2) return true;\n        return false;\n    }\n    public boolean checkPal(int n){\n        int ori = n;\n        int rev = 0;\n        while(n>0){\n            rev=rev*10+n%10;\n            n=n/10;\n        }\n\n        if(rev==ori) return true;\n        return false;\n    }\n\n    public int primePalindrome(int n) {\n        if(checkPal(n)){\n            if(checkPrime(n))\n                return n;\n        }\n        \n        while(n>0){\n            if(checkPal(n)){\n                if(checkPrime(n))\n                    return n;\n            }\n            n++;\n            if (n > 10_000_000 && n< 100_000_000) {\n                n = 100_000_000; \n            }\n        }\n\n        return n;\n    }\n}\n```
['Java']