find palindrome first
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```csharp []\npublic class Solution {\n    public int PrimePalindrome(int n) {\n        n = n -1;\n        while(true){\n            n = next(n);\n            if (prime(n)){\n                return n;\n            }\n        }\n        return -1;\n\n        int next(int n){\n            if (n < 10){\n                return n + 1;\n            }\n\n            var s = n.ToString();\n            var m = s.Length;\n            var left = s.Substring(0, m /2);\n            var right = s.Substring((m+1) /2);\n            var head = s.Substring(0, (m + 1)/2);\n\n            Console.WriteLine($"{new {n, left, right, head}}");\n            if (int.Parse(left) <= int.Parse(right)){\n                head = (int.Parse(head) + 1).ToString();\n            }\n\n            s = head + reverse(head.Substring(0, m /2));\n            \n            if (s == n.ToString()){\n                head = (int.Parse(head) + 1).ToString();\n                s = head + reverse(head.Substring(0, m /2));\n            }\n            return int.Parse(s);\n        }\n        string reverse(string s){\n            var arr = s.ToCharArray();\n            Array.Reverse(arr);\n            return new string(arr);\n        }\n        bool prime(int n ){\n            if (n < 2){\n                return false;\n            }\n            if (n == 2){\n                return true;\n            }\n\n            for (var i = 2; i * i <= n ; i ++){\n                if ( n % i == 0){\n                    return false;\n                }\n            }\n            return true;\n        }\n    }\n}\n```
['C#']