Did you know ... Search Documentation:
Pack nan_numerics_prime -- prolog/nan_numerics_prime_mem.pl
PublicShow source

Module prime_mem provides low-level predicates for the memoization of pairs of consecutive prime numbers.

NOTE: Predicates in this module are not meant for public use.

author
- Julio P. Di Egidio
version
- 1.2.5-beta
license
- GNU GPLv3
To be done
- Use gobal variables?
- Implement size limits? (By recent use?)
 gen_(?P1:prime, ?P2:prime) is nondet
Generates the memoized pairs (for program inspection).
 get_(+P0:prime) is semidet
 get_(+P0:prime, -P:prime) is semidet
get_(-P:prime, +P0:prime) is semidet
True if P0 exists in some memoized pair with P its consecutive (resp. for the two variants with arity 2) successor/predecessor prime.
 add_(+P1:prime, +P2:prime) is det
Memoizes the pair P1, P2.

NOTE: Does not check that P1, P2 is a pair of consecutive prime numbers and that the pair has not already been memoized.

 count_(-Count:nonneg) is det
Count is the number of memoized pairs.
 max_(-Max:prime) is det
Max is the greatest prime number that exists in any memoized pair.

Max is 2 if no memoized pair exists.

 clear_ is det
Clears all memoization.