Is $20+k^2\not\equiv4(\text{mod}~7)$ for all $k\geq0$?

66 Views Asked by At

I've been asked to explain why during quadratic probing in a hash function it is possible that a collision resolution is never found (eg. empty spots exist in the hash table, but the quadratic probing will never resolve to that position).

I have an example where index $4$ is the last free index in the hash table, however it is impossible to insert the key $20$ because it will never be resolved to index $4$ in the hash table (impossible for the hash function to return $4$). This is because $20+k^2\text{mod}~7\neq4$ for all $k\geq0$ .

I think I have reduced it to a congruence relation correctly:

$20+k^2\not\equiv4(\text{mod}~7)$ for all $k\geq0$

I am quite sure the above statement is true, however I can't explain why it is true. Are there some (modular arithmetic) properties that cause this effect?

2

There are 2 best solutions below

2
On BEST ANSWER

First, subtract 4 from both sides, and then subtract 14, to get $2+k^2$ is not $0$ modulo $7.$ Now, just try the seven possibilities for $k.$

0
On

Hint $\rm\ \ mod\ 7\!:\ k^2\equiv -2\ \overset{cube}\Rightarrow\ k^6 \equiv -1,\ $ contra little Fermat.