| Allegro CL version 10.0 New since the initial 10.0 release. |
Arguments: int
Returns a positive fixnum suitable for a hash-table size greater than
or equal to int, which should be a fixnum.
With all fixnums below the limit, the value returned will be a prime
number. The value is returned from a table, so the calculation is
fast. For fixnums above the limit, the value returned is at least not
divisible by 2, 3, 5, or 7. Results lose accuracy as they approach
most-positive-fixnum
.
Limits are approximate, and may change in the future. Currently:
(/
most-positive-fixnum 2)
and most-positive-fixnum
.
(expt 2
47)
and (expt 2 48)
.
Not all prime numbers are returned. The prime number table is populated with an approximately 2% increment, so the difference between one result and the next possible result (for values of int under the limit) are approximately 2% apart:
cl-user(1): (excl:hash-primify 100000000) 100121387 cl-user(2): (excl:hash-primify (1+ *)) 102123817 cl-user(3): (float (/ * **)) 1.02 cl-user(4):
There may be other prime numbers not returned by this function; but because it is the goal of this function to quickly return a size suitable for efficient hash-table operation, populating all primes is not necessary.
Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page is new in the 10.0 release.
Created 2019.8.20.
| Allegro CL version 10.0 New since the initial 10.0 release. |