HARSHAD - Devlali Numbers
Devlali numbers were an important coinage by Indian recreational mathemtician D. R. Kaprekar.
For any positive integer n, define d(n) as the sum of n and the digits of n. Eg, d(199)=199+1+9+9=218.
For a positive number m, if there exists no positive number r such that d(r)=m, then m is a Devlali number. First few Devlali numbers are 1,3,5,7.. so on.
A prime number falling in this family is called a Devlali Prime. First few Devlali Primes are 3,5,7,.. so on.
first line contains integer Q
Next Q lines contain two integers A and B
print Q lines, each listing number of Devlali Primes in range [A,B] (both inclusive)
more testcases please with some big nmbers,testcase 5 wrong
good question....using stl the code length reduces to 1/4... :)
Jugal kishor sahu:
Finally done..!! Good ques.