Notebook/src-bkp/Miller-Rabin Primality Test.cpp
bool isPrime(Int n, int k) {
    if (n <= 1 || n == 4)  return false;
    if (n <= 3) return true;
 
    Int d = n - 1;
    while (d % 2 == 0) {
        d /= 2;
    }
 
    for (int i = 0; i < k; i++) {
        if (miillerTest(d, n) == false) {
              return false;
        }
    }
 
    return true;
}
// It returns false if n is composite and returns true if n
// is probably prime.  k is an input parameter that determines
// accuracy level. Higher value of k indicates more accuracy.
It returns false if n is composite and returns true if n
is probably prime.  k is an input parameter that determines
accuracy level. Higher value of k indicates more accuracy.
It returns false if n is composite and returns true if n is probably prime . k is an input parameter that determines accuracy level . Higher value of k indicates more accuracy .
bool isPrime(Int n, int k) {
    if (n <= 1 || n == 4)  return false;
    if (n <= 3) return true;
    Int d = n - 1;
    while (d % 2 == 0) {
        d /= 2;
    }
    for (int i = 0; i < k; i++) {
        if (miillerTest(d, n) == false) {
              return false;
        }
    }
    return true;
}
bool isPrime ( Int n , int k ) { if ( n <= 1 || n == 4 ) return false ; if ( n <= 3 ) return true ; Int d = n - 1 ; while ( d % 2 == 0 ) { d /= 2 ; } for ( int i = 0 ; i < k ; i ++ ) { if ( miillerTest ( d , n ) == false ) { return false ; } } return true ; }
It returns false if n is composite and returns true if n
is probably prime.
It returns false if n is composite and returns true if n is probably prime .