Problem
Java
Brute-force
Except for 11, all palindromic primes have an odd number of digits, because the divisibility test for 11 tells us that every palindromic number with an even number of digits is a multiple of 11.
1 | class Solution { |
Submission Detail
- 60 / 60 test cases passed.
- Runtime: 1087 ms, faster than 5.56% of Java online submissions for Prime Palindrome.
- Memory Usage: 35.5 MB, less than 97.78% of Java online submissions for Prime Palindrome.
- Palindromic prime
- What would be the fastest method to test for primality in Java?
- Easy to Understand c++ solution
- It is not known if there are infinitely many palindromic primes in base 10.
- December 2, 2021 is a palindrome day as 12-2-21, 12-02-2021 and 2021-12-02.