BlueBook - Prime

View as PDF

Submit solution

Points: 4
Time limit: 1.0s
Memory limit: 16M

Problem type
BlueBook

Given T (1 \le T \le 10\,000) integers N (1 \le N < 2^{16}), output 1 if each one is prime, and 0 otherwise.

Remember: an integer is prime iff (if and only if) it has exactly two divisors: 1 and N.

Input Specification

Line 1: one integer T Lines 2\ldots T+1: one integer N

Output Specification

Lines 1\ldots T: One integer 1 or 0 denoting whether N is prime. Output 1 if N is prime, and 0 otherwise.

Sample Input

3
1
2
3

Sample Output

0
1
1

Comments

There are no comments at the moment.