[Mono-list] More fighting with Hashtable
Thomas F. Burdick
tfb@OCF.Berkeley.EDU
Fri, 13 Jul 2001 16:22:42 -0700
John Barnette writes:
> > Hmm, keeping an array of the primes less than 2^32 would be pretty
^
oops: "that we need"--------------------+
> > easy. Maybe a back-up prime number generator wouldn't be bad as a
> > backup for the pathological case where a hash table has more than 2^32
> > buckets, but it seems a waste to do that computation for anything but
> > the pathological cases.
>
> Well, there are 203280221 primes in the range 2-2^32 inclusive. This looks
> like a bloody large array to me. Or have I made a stupid mistake?
* (loop for x = (next-prime 2) then (next-prime (* 2 x))
with end = (expt 2 32)
if (<= x end)
collect x
else do (loop-finish))
(2 5 11 23 47 97 197 397 797 1597 3203 6421 12853 25717 51437 102877 205759
411527 823117 1646237 3292489 6584983 13169977 26339969 52679969 105359939
210719881 421439783 842879579 1685759167 3371518343)
* (length *)
31
And I assume we won't have hash tables start quite that small :)