Supposing simple uniform hashing, that being, any given value is equally like to hash into any of the slots of the hash. Why is it better to use a table of size 127 and not 128?
I believe that it just has to do with the fact that computers work with in base 2. Something similar happens with base 10.
...
Picking a big enough, non-power-of-two number will make sure the hash function really is a function of all the input bits, rather than a subset of them.
From Why hash tables should use a prime-number size.