Best solution of this problem
IntuitionApproachComplexity
Time complexity:O(Sqrt(N)∗Log(N))

Space complexity:O(1)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:O(Sqrt(N)∗Log(N))
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int primePalindrome(int n) {
        int i = n;
        while (true) {
            if (n >= 8 && n <= 11) {
                return 11;
            }
            if (isPal(i) && isPrime(i)) {
                return i;
            }
            i++;
            if(len(i)%2==0){
                i = (int)Math.pow(10,len(i));
            }
        }
    }
    boolean isPrime(int num) {
        if (num < 2) return false;
        if (num % 2 == 0 && num != 2) return false;
        for (int j = 3; j <= Math.sqrt(num); j++) {
            if (num % j == 0) return false;
        }
        return true;
    }
    boolean isPal(int num) {
        int original = num, r = 0;
        while (num > 0) {
            r = r * 10 + num % 10;
            num /= 10;
        }
        return original == r;
    }
    int len(int n){
        return (int) Math.log10(n)+1;
    }
}

```
['Java']