CiscoOA #7
Prime vs Composite
Estimated EasyJudge-ready
Topics (AI-labelled)Bits & Math
Output Prime or Composite for each integer. A number that is at least 2 and has exactly two positive divisors, 1 and itself, is prime and outputs Prime; every other integer uses the original problem's output label for non-prime, uniformly Composite. Therefore 0, 1, and negative integers also output Composite.
Input
The first line contains N, and the second line contains N integers. The original gave no numeric bounds; this site uses 0≤N≤2000 and −2^31≤a[i]≤2^31−1. An empty list produces empty output text.
Output
Output Prime or Composite for each item, one per line; an empty list produces empty output text.
Example 1
Input:
5
541 37 113 5 10
Output:
Prime
Prime
Prime
Prime
Composite
Example 2
Input:
5
-1 0 1 2 4
Output:
Composite
Composite
Composite
Prime
Composite
Example 3
Input:
0
Output:
Example notes
The outputs of the three public examples are, in order: Prime / Prime / Prime / Prime / Composite; Composite / Composite / Composite / Prime / Composite; empty text. Verified by independent enumeration or direct simulation.
Editorial
Loading solution…