P20898 [GeeksforGeeks] Prime palindrome sum3700
普及-
题目描述

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.

Example 1:
Input:
a = 1, b = 10
Output:
17
Explanation:
prime numbers between 1 and 10 are 2, 3,
5, and 7. All of these are Palindromes.
So, sum = 17.
Example 2:
Input:
a = 11, b = 13
Output:
11
Explanation:
prime numbers between 11 and 13 are 11
and 13. Omly 11 is Palindrome among these.
So, sum = 11.

Your Task:
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)

Constraints:
1 <= A <= B <= 10^{5}

输入格式

见题面

输出格式

见题面

样例输入
a = 1, b = 10
样例输出
17