Prime Check

Lab Python Intermediate 20 points

Read an integer n ≥ 2 and print prime or composite. Only test divisors up to √n.

Input

One integer.

Output

One word.

Example

Input

2

Output

prime
Sample input available Sample output available
Editor
Python

Hints

If n has a divisor, one of them is at most sqrt(n).

Stop as soon as you find a divisor.

Solution explanation

Checking only up to √n turns millions of steps into about a thousand for n ≈ 10⁶.

Show solution
n = int(input())
d = 2
while d * d <= n:
    if n % d == 0:
        print("composite")
        break
    d += 1
else:
    print("prime")
Output
Answer
HOME LEARN COMMUNITY DASHBOARD