Please enter your email address or userHandle.
Given is a range of integers [a , b] . You have to find the sum of all the numbers in the range [a , b] that are prime as well as palindrome.
a = 1, b = 10
prime numbers between 1 and 10 are 2, 3,
5, and 7. All of these are Palindromes.
So, sum = 17.
a = 11, b = 13
prime numbers between 11 and 13 are 11
and 13. Omly 11 is Palindrome among these.
So, sum = 11.
You don't need to read input or print anything. Your task is to complete the function getPPS() which takes 2 Integers a and b as input and returns an integer as the answer.
Expected Time Complexity: O(loglog(B))
Expected Auxiliary Space: O(B)
1 <= A <= B <= 105
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.