Re-implemented functionalities in primes.c.

The new functions are more correct than the previous ones.
The new implementation is not GPL-2 licensed.
The new implementation is deterministic.
The new implementation is generally faster.
Updated primes.h.
Updated hash.c according to changes in primes.*.
Updated acopost_test.c according to changes in primes.*.