Verifica dei numeri primi
Un numero è considerato primo se è divisibile solo per se stesso e per 1 (esattamente due numeri).
Implementa una funzione is_prime(n) che restituisca True se n è un numero primo e False altrimenti.
L'input contiene un singolo numero intero n (1 ≤ n ≤ ).
Il programma dovrebbe stampare Yes se n è primo e No altrimenti.
Input | Output |
|---|---|
7 | Yes |
1 | No |
8 | No |
5 | Yes |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB