Problem F
Pseudoprime numbers

Fermat’s theorem states that for any prime number
Given
Input
Input contains several test cases followed by a line
containing “0 0”. Each test case consists of a line containing
Output
For each test case, output “yes”
if
Sample Input 1 | Sample Output 1 |
---|---|
3 2 10 3 341 2 341 3 1105 2 1105 3 0 0 |
no no yes no yes yes |