Forgot Password ?
New password will be sent to following email id
Motu and Marriage
Problem Code : MARRIAGE
2 20 30
Time Limit :
C , C++ , Java , Python 2
Login to submit your response.
As we all know that Motu’s marriage is in January 2017, Motu is busy in thinking whom he should invite and whom he should not. After lot of thinking he finally wrote <b>N</b> names on a paper and provided each name a unique id from <b>1</b> to <b>N</b>. Now as he is awesome in mathematics and very moody , he decides that he will call only those person whose id is <b>prime id</b>. A <b>prime id</b> is that id in which the <b>difference between the adjacent digits is prime</b>. He becomes very excited and asks his bride to calculate number of persons attending their marriage. Help his bride!!!!!!!!!
First line consists of <b>T</b> denoting number of test cases. <br> Each test case consists of a single integer denoting N persons having id <b>1</b> to <b>N</b>.
Print number of guests whom Motu will invite for the marriage.
1 ≤ <b>T</b> ≤ 10000<br> 1 ≤ <b>N</b> ≤ 10<sup>9</sup>
For 1st test case persons having Id's 1,2,3,4,5,6,7,8,9,13,14,16,18,20 will be invited.