Skip to content

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)
    }
    
    bool IntNextPrime(Int *result, const Int *value) {
        bool error = false;
    
    bool test_int_next_prime(void) {
        WriteFmt("Testing IntNextPrime\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        Str text  = StrInit(&alloc.base);
    
        bool ok = IntNextPrime(&next, &value);
        text    = IntToStr(&next);
Last updated on