To generate a hash function, Map a key k into one of m slots by taking the remainder of k divided by m. That is, the hash function is
h(k) = k mod m.
I have read at several places that a good choice of m will be
- A prime - I understand that we want to remove common factors, hence a prime number is chosen
- not too close to an exact power of 2 - why is that?