Prime checking

A number is considered prime if it’s only divisible by itself and by 1 (exactly two numbers).
Implement a function is_prime(n) that would return True if n is prime and False otherwise.
The input contains a single integer n (1 ≤ n ≤ ).
The program should print Yes if n is prime and No otherwise.
Input
Output
7
Yes
1
No
8
No
5
Yes
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue