Skip to main content

Practice · 3 of 5

Prime Verdict

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** For each query n, print PRIME if n is prime, COMPOSITE if it has a divisor other than 1 and itself, and NEITHER for n < 2. **Input:** Line 1: t (1 <= t <= 10^5). Each of the next t lines: n (0 <= n <= 10^12). **Output:** t lines: PRIME, COMPOSITE, or NEITHER. **Example:** 7 -> PRIME; 9 -> COMPOSITE; 1 -> NEITHER.

Back to lesson: Practice: Number Theory Problem Set