You are here
Home ›good hash table primes
Primary tabs
good hash table primes
In the course of designing a good hashing configuration, it is helpful to have a list of prime numbers for the hash table size.
The following is such a list. It has the properties that:
1. 2. each number is slightly less than twice the size of the previous
3. each number is as far as possible from the nearest two powers of two
Using primes for hash tables is a good idea because it minimizes clustering in the hashed table. Item (2) is nice because it is convenient for growing a hash table in the face of expanding data. Item (3) has, allegedly, been shown to yield especially good results in practice.
And here is the list:
| lwr | upr | % err | prime |
|---|---|---|---|
| 10.416667 | 53 | ||
| 1.041667 | 97 | ||
| 0.520833 | 193 | ||
| 1.302083 | 389 | ||
| 0.130208 | 769 | ||
| 0.455729 | 1543 | ||
| 0.227865 | 3079 | ||
| 0.113932 | 6151 | ||
| 0.008138 | 12289 | ||
| 0.069173 | 24593 | ||
| 0.010173 | 49157 | ||
| 0.013224 | 98317 | ||
| 0.002543 | 196613 | ||
| 0.006358 | 393241 | ||
| 0.000127 | 786433 | ||
| 0.000318 | 1572869 | ||
| 0.000350 | 3145739 | ||
| 0.000207 | 6291469 | ||
| 0.000040 | 12582917 | ||
| 0.000075 | 25165843 | ||
| 0.000010 | 50331653 | ||
| 0.000023 | 100663319 | ||
| 0.000009 | 201326611 | ||
| 0.000001 | 402653189 | ||
| 0.000011 | 805306457 | ||
| 0.000000 | 1610612741 |
The columns are, in order, the lower bounding power of two, the upper bounding power of two, the relative deviation (in percent) of the prime number from the optimal middle of the first two, and finally the prime itself.
Happy hashing!
Mathematics Subject Classification
68P05 Data structures68P10 Searching and sorting
68P20 Information storage and retrieval
- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)
- Other useful stuff
Recent Activity
new question: Sorry to steal a few minutes of your time for this question, but i honestly don't know what else to do. by Whrazithar
new question: equality of the determinants of submatrices of an orthogonal matrix by ismayli
Jun 11
new correction: Typo by suitangi
Jun 2
new question: Creating another set with same cardinality. by hkkass
Jun 1
new image: ProblemOneRevised by unlord
new Education: Chapter II by rspuzio
May 31
new collection: The Calculus by Davis and Brenke by rspuzio
new question: Proofs by weixifan
new question: Summation Integration Question by trevor.nickle
May 27
new correction: typo+finite measure hypothesis by Filipe


