isProbablePrime method

bool isProbablePrime([
  1. int certainty = 10
])

Returns true if this BigInteger is probably prime.

certainty the certainty level (higher = more certain)

Implementation

bool isProbablePrime([int certainty = 10]) {
  // Simple primality test - can be enhanced
  if (_value <= BigInt.one) return false;
  if (_value == BigInt.two) return true;
  if (_value.isEven) return false;

  // Miller-Rabin would be better, but this is a simple implementation
  for (int i = 0; i < certainty; i++) {
    // Simplified test
    if (_value % BigInt.from(3) == BigInt.zero && _value != BigInt.from(3)) return false;
    if (_value % BigInt.from(5) == BigInt.zero && _value != BigInt.from(5)) return false;
    if (_value % BigInt.from(7) == BigInt.zero && _value != BigInt.from(7)) return false;
  }
  return true; // Simplified - real implementation would be more thorough
}