import java.math.BigInteger;
import java.util.*;
class Main {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
while(true){
BigInteger p=in.nextBigInteger();
BigInteger a=in.nextBigInteger();
if(p.equals(BigInteger.ZERO))
return;
if(p.isProbablePrime(15)){
System.out.println("no");
}
else if((a.modPow(p,p)).equals(a))
System.out.println("yes");
else
System.out.println("no");
}
}
}
import java.util.*;
class Main {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
while(true){
BigInteger p=in.nextBigInteger();
BigInteger a=in.nextBigInteger();
if(p.equals(BigInteger.ZERO))
return;
if(p.isProbablePrime(15)){
System.out.println("no");
}
else if((a.modPow(p,p)).equals(a))
System.out.println("yes");
else
System.out.println("no");
}
}
}
Comments
Post a Comment