Close
Topic list
Prime Digit Sum
HARD
45 mins
Dynamic Programming
Topics (Covered in this problem)
Problem solved
Skill meter
Dynamic Programming
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Prime Digit Sum

Contributed by
Rakesh Tiwari
Hard
0/120
Avg time to solve 45 mins
Success Rate 70 %
Share

## Problem Statement

#### Output the number of good numbers.

##### Example :
``````Input:
'L' = 15 and 'R' = 19
There is only 1 number between which is good,
16 = 1 + 6 = 7 (which is a prime number).
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1 :
``````2
5 11
1 20
``````
##### Sample Output 1 :
``````3
9
``````
##### Explanation Of Sample Input 1 :
``````For test case 1 we have,

5 , 7 ,
11 = 1+1 = 2
As 2, 5, 7 are prime numbers so 5, 7, 11 are good.

For test case 2 we have,

2, 3, 5, 7,
11 = 1 + 1 = 2
12 = 1 + 2 = 3
14 = 1 + 4 = 5
16 = 1 + 6 = 7
20 = 2 + 0 = 2
As 2, 3, 5, 7 are prime numbers so 2, 3, 5, 7, 11, 12, 14, 16, 20 are good.
``````
##### Sample Input 2 :
``````2
12 16
9 19
``````
##### Sample Output 2 :
``````3
4
``````
Auto
Console