All Tracks Math Number Theory Primality Tests Problem

We love pirates!
Tag(s):

Easy

Problem
Editorial
Analytics

Compact Disk Digital Audio, or CD, are encoded using prime numbers as encryption key. The pirate king of the batch, Sanjay Prajapat, has the CD of his favorite WWE fight clip, featuring Stone Cold scaring the pants off Ronald Krump. He wants to upload the clip to a famous torrent website which features a pirate ship as its symbol. Since uploading the clip requires the CD be decoded, one must know about prime numbers. Sanjay doesn't know how to check whether a number is prime or not. So he took the help of his friend Bissu (the Java Collections God), who unwillingly gave some prime numbers to Sanjay. Thus Sanjay knows some prime numbers less than or equal to N. Since decoding requires bigger prime numbers, Sanjay wants to find how many distinct prime numbers he can make using the sum of at least two consecutive prime numbers less than or equal to N. Help him find the count of such numbers.

Input:

T, the number of test cases
Each of the next T lines contain a number N.

Output:

For each value of N, output the required number in a new line.

Constraints:

1 <= T <= 1000
1 <= N <= 1000

SAMPLE INPUT
2
5
10
SAMPLE OUTPUT
1
2
Explanation

For first case, N = 5
There are 3 prime numbers less than or equal to 5: 2 , 3 ,5.
Desired prime numbers are : 2+3 = 5

For second case, N = 10
There are 4 prime numbers less than or equal to 10 : 2 , 3 , 5 , 7.
Desired prime numbers are : 2+3 = 5 , 2+3+5+7 =17.
So the answer is 2.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications