Prime Palindrome

Given an integer n, return the smallest prime palindrome number that is greater than or equal to n.

Input Format

n = lower bound

Output Format

smallest prime palindrome >= n

Constraints

  • 1 <= n <= 10^8

Examples

Example 1:

Input:

n = 6

Output:

7

Explanation:

7 is both prime and a palindrome.

Example 2:

Input:

n = 8

Output:

11

Explanation:

11 is the next prime palindrome.

Loading...
Prime Palindrome - Math DSA Problem