LiangCh10Section9/src/ch10Exercise18Jsquared21Version/Ch10Exercise18.java
public static boolean isPrime(BigInteger n) {
		for (BigInteger d = new BigInteger("2"); 
				d.compareTo(n.divide(new BigInteger("2"))) <= 0; 
				d = d.add(new BigInteger("1"))) {
			if (n.remainder(d).compareTo(new BigInteger("0")) == 0) {
				return false;
			}
		}
		return true;
	}
/** Return true if number is prime */
Return true if number is prime
Return true if number is prime
public static boolean isPrime(BigInteger n) {
		for (BigInteger d = new BigInteger("2"); 
				d.compareTo(n.divide(new BigInteger("2"))) <= 0; 
				d = d.add(new BigInteger("1"))) {
			if (n.remainder(d).compareTo(new BigInteger("0")) == 0) {
				return false;
			}
		}
		return true;
	}
public static boolean isPrime ( BigInteger n ) { for ( BigInteger d = new BigInteger ( "2" ) ; d . compareTo ( n . divide ( new BigInteger ( "2" ) ) ) <= 0 ; d = d . add ( new BigInteger ( "1" ) ) ) { if ( n . remainder ( d ) . compareTo ( new BigInteger ( "0" ) ) == 0 ) { return false ; } } return true ; }
Return true if number is prime
Return true if number is prime