There is a standard hash function where we take the mod from the key in order to define the address. That is, h(k) = k(mod) p (where p is some prime number).This is called the division method. I have seen a variation of this "division method" where you first multiply the key by a prime and then you take the mod. For example: h(k) = (k*17) mod 11. What is the purpose to multiply the key by a prime (17,37...) before calculating the mod?? is it to improve the distribution of the keys?
            Asked
            
        
        
            Active
            
        
            Viewed 55 times
        
    0
            
            
        - 
                    I think the primary reason is that it de-linearizes the function so that `h(k+1) != h(k) + 1`... There might be other reasons. – twalberg Oct 07 '13 at 16:59
- 
                    http://stackoverflow.com/questions/3613102/why-use-a-prime-number-in-hashcode – JNL Oct 07 '13 at 18:05
