java
\tclass Solution {\n\t\tpublic int primePalindrome(int N) {\n\t\t\tif (N == 1) return 2;\n\t\t\twhile (true) {\n\t\t\t\tif (checkPalindrome(N) && checkPrime(N))
\tclass Solution {\n\t\tpublic int primePalindrome(int N) {\n\t\t\tif (N == 1) return 2;\n\t\t\twhile (true) {\n\t\t\t\tif (checkPalindrome(N) && checkPrime(N)) {\n\t\t\t\t\treturn N;\n\t\t\t\t}\n\t\t\t\tN++;\n\t\t\t\tif (10_000_000 < N && N < 100_000_000)\n\t\t\t\t\tN = 100_000_000;\n\t\t\t}\n\t\t}\n\n\t\tpublic boolean checkPalindrome(int N) {\n\t\t\tchar[] arr = Integer.toString(N).toCharArray();\n\t\t\tint len = arr.length;\n\t\t\tint i;\n\t\t\tint j;\n\t\t\tint mid = len / 2;\n\t\t\tif (len % 2 == 0) {\n\t\t\t\ti = mid - 1;\n\t\t\t\tj = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ti = mid - 1;\n\t\t\t\tj = mid + 1;\n\t\t\t}\n\t\t\twhile (i < j && i >= 0) {\n\t\t\t\tif (arr[i--] != arr[j++]) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t// public int reverse(int x) {\n\t\t//     int rev= 0;\n\t\t//     while( x > 0){\n\t\t//         rev= rev * 10 + x % 10;\n\t\t//         x= x / 10;\n\t\t//     }\n\t\t//     return rev;\n\t\t// }\n\n\t\tpublic boolean checkPrime(int N) {\n\t\t\tboolean flag = true;\n\t\t\tif (N < 2) return false;\n\t\t\telse {\n\t\t\t\tfor (int i = 2; i <= (int)Math.sqrt(N); i++) {\n\t\t\t\t\tif (N % i == 0) {\n\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn flag;\n\t\t}\n\n\t}
[]