IntNextPrime
Description
Find the next probable prime greater than or equal to a value.
Parameters
| Name | Direction | Description |
|---|---|---|
result |
out | Destination for the prime |
value |
in | Starting point |
Usage example (from documentation)
bool ok = IntNextPrime(&prime, &value);Success
Returns true. *result holds the smallest probable prime >= *value.
Failure
Returns false on allocator OOM during the witness loop, or if the primality oracle gives up. *result is left untouched.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:2866:
}
bool IntNextPrime(Int *result, const Int *value) {
bool error = false;- In
Int.Math.c:889:
bool test_int_next_prime(void) {
WriteFmt("Testing IntNextPrime\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Math.c:897:
Str text = StrInit(&alloc.base);
bool ok = IntNextPrime(&next, &value);
text = IntToStr(&next);
Last updated on