I have been asked what is a problem with hash function:
h(S) = ((sum(S[i]*x**i)) mod p) mod m, where i = {1, ..., s-1}. S - some long string, x - some positive number, s - length of S, p - number(1e9), m - hash table capacity.
How can I lower probability of collision in this hash function? Maybe x and p must be relatively prime numbers, or some group of string in this hash function would give same hashes and I need somehow change it?
I thought that problem is overflow and tried Horner's method, but the problem turned out to be collisions