DescriptionFermat's theorem states that for any prime number p and for any integer a> 1, ap = a (mod p ). that is, if we raise a to the pth power and divide by p, the remainder is. some (but not very values) non-prime values of p, known as base-a pseudo doprimes, have this property for some. (And some, known as Carmichael Numbers, are base-a pseudo Primes for all .) given 2 <p ≤ 1000000000 and 1 <a <p, determine whether or not p is a base-a Pseudo Prime. inputInput contains several test cases followed by a line containing "0 0 ". each test case consists of a line containing p and. outputFor each test case, output "yes" if p is a base-a pseudo-prime; otherwise output "no ". sample Input3 210 3341 2341 31105 21105 30 0 Sample Outputnonoyesnoyesyes [cpp] [cpp] # include Using namespace std; int prime (long a) {int I; if (a = 2) return 1; for (I = 2; I * I <=; I ++) if (a % I = 0) return 0; return 1;} long mod (long a, long B, long m) {long ans = 1; while (B> 0) {if (B & 1) {ans = ans * a % m; // B --;} B >>= 1; a = a * a % m;} return ans;} int main () {long a, p; while (cin> p> a & (p | a) {long ans; if (prime (p) cout <"no" <endl; else {ans = mod (a, p, p); if (ans = a) cout <"yes" <endl; else cout <"no" <endl ;}} return 0 ;}