Problem
A prime number (or a prime) is a natural number greater than 1 that can only be divided by 1 and itself.
Ex-First few Prime number are-
2, 3, 5, 7, 11, 13, 17, 19,...
A digit prime is a prime number whose sum of digits is also prime.
For example the prime number 23 is a digit prime because 2+3=5 and 5 is a prime number. 17 is not a digit prime because 1+7 = 8, and 8 is not a prime number. Write a program to find out the number of digit primes within a certain range less than 1000000.and also print the Mth digit prime number between the range.
Input:
Input line contains three positive integers (T1 T2 M) separated by space where lower limit is T1 and upper limit is T2 and M is the position of the required digit prime number.
|
Line 1
|
T1 T2 M, where T1 is upper limit, T2 is lower limit and M is the position of the required digit prime number.
|
Constraints:
0 < T1 <= T2 < 1000000
0 < M
Output:
Print Mth digit prime number between T1 and T2(inclusive).
|
Line 1
|
For Valid Input,print
Mth digit prime number between T1 and T2.
Or
No number is present at this index
For Invalid Input,print
Invalid Input
|
Sample Input and Output
|
SNo.
|
Input
|
Output
|
|
1
|
25 100 5
|
61
|
|
2
|
1 3 5
|
No number is present at this index
|
|
3
|
-5 3 a
|
Invalid Input
|
Note:
Participants submitting solutions in C language should not use functions from <conio.h> / <process.h> as these files do not exist in gcc