In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of October 19th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #02 exercise sheet]
Little John is fascinated with mathematics. Right now, his older brother is teaching him everything about prime numbers. Recall that a prime number is an integer greater than 1 that is not a product of two smaller natural numbers.
John needs your help to compute which numbers are prime!.
Given a sequence of Q integer numbers greater than 1, your task is to compute which ones of them are prime, and which are composite.
The first line of input contains Q, the quantity of numbers to process.
The second line of input contains Q integer numbers ni, separated by single spaces.
Q lines, each one in the form "Ni is prime" or "ni is composite" (without the quotes) if the number Ni is respectively prime or composite.
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ Q ≤ 100 | Quantity of numbers to consider | |
2 ≤ ni ≤ 109 | Range of each number |
Example Input | Example Output |
6 2 3 4 29 21 733 |
2 is prime 3 is prime 4 is composite 29 is prime 21 is composite 733 is prime |