IntIsProbablePrime
IntIsProbablePrime
Description
Perform a probabilistic primality test.
This is a probable-prime test, not a proof of primality.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to test |
Usage example (from documentation)
bool prime = IntIsProbablePrime(&value);Returns
true when the value is probably prime.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:1665:
return true;
}
if (IntIsEven(modulus) || !IntIsProbablePrime(modulus)) {
IntDeinit(&a);
return false;- In
Int.c:1785:
}
bool IntIsProbablePrime(Int *value) {
static const u64 bases[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37};- In
Int.c:1897:
}
while (!IntIsProbablePrime(&candidate)) {
MISRA_PRIV_IntAddU64(&candidate, &candidate, 2);
}- In
Int.Math.c:757:
bool test_int_is_probable_prime(void) {
WriteFmt("Testing IntIsProbablePrime\n");
Int prime = IntFromStr("1000000007");- In
Int.Math.c:762:
Int composite = IntFrom(561);
bool result = IntIsProbablePrime(&prime);
result = result && !IntIsProbablePrime(&composite);- In
Int.Math.c:763:
bool result = IntIsProbablePrime(&prime);
result = result && !IntIsProbablePrime(&composite);
IntDeinit(&prime);
Last updated on