static boolean isPrime(int n){
boolean result=true;
if(n <= 1) return false;
for(int i = 2; i <= n/2; i++){
if(n % i == 0){
result = false; //if some number divides it, then prime=false;
break;
}
}
return result;
}
boolean isPrime(long n) {
if(n < 2) return false;
if(n == 2 || n == 3) return true;
if(n%2 == 0 || n%3 == 0) return false;
long sqrtN = (long)Math.sqrt(n)+1;
for(long i = 6L; i <= sqrtN; i += 6) {
if(n%(i-1) == 0 || n%(i+1) == 0) return false;
}
return true;
}