mediumMathNumber Theory 0 views
Prime Palindrome
Given an integer n, return the smallest prime palindrome greater than or equal to n.
Given an integer n, return the smallest prime palindrome greater than or equal to n.
An integer is prime if it has exactly two divisors: 1 and itself. Note that 1 is not a prime number.
An integer is a palindrome if it reads the same from left to right as it does from right to left.
The test cases are generated so that the answer always exists and is in the range [2, 2 * 10^8].
Example 1
Input: n = 6
Output: 7
Example 2
Input: n = 8
Output: 11
Example 3
Input: n = 13
Output: 10^1
Constraints
- 1 <= n <= 10^8
Hints
No hints yet.
Companies
No companies reported yet.
Discussion
Sign in to join the discussion.
Loading discussion...
Test results
No test cases yet.