| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |
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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |