Whether this has an impact (also) depends on how you treat collisions. When using some variants of open hashing, using primes guarantees empty slots are found as long as the table is sufficiently empty.

Try to show the following, for instance:


  Assume we want to insert an element that hashes to address $a$ and resolve collisions by trying positions $a + i^2$ subsequently for $i=1,2,\dots$.
  
  Show that this procedure always yields an empty position if the hash table is of size $p$, $p$ a prime larger than $3$, and at least half of all positions are free.
  
  Hint: Use the fact that the residue class ring modulo $p$ is a field if $p$ is prime and therefore $i^2=c$ has at most $2$ solutions.


Why is it best to use a prime number as a mod in a hashing function?
Beginner question, I have been trying to figure out how my book got the solution it did for this question :

$$\frac{(2r^2)^5 (3r^4)^3}{(6r^3)^2} = 24r^{16} $$

I get the $r^{16}$ part but how did they get 24?!

EDIT

Thanks to Brian for the clear answer below. In maths the same answer can be reached many ways, I tried like this :

$$\frac{2^5r^{10}   9r^{12}}{6r^6} = \frac{311r^{22}}{36r^6}= \text{something strange}$$

Please if you could let me know why my approach is leading to an incorrect answer and at which stage is my mistake?
