Your question says that you are trying to pick a prime number that is closest to the number of buckets. Presumably you are doing this to avoid wasting buckets...
That's not how you do it.
When you apply a prime number modulus to your hash, then you pick a prime number of buckets. The modulus is exactly the number of buckets.
The number of buckets you choose typically depends on the number of items in the table. Usually when this choice is made, the target table size is somewhere around 2n, where n is the number of items.
There is no need to be precise, however. If you have a hard-coded list of 256 primes, logarithmically distributed so that the ith one is about 2^(i/4), then you can just find the one that is closest to 2n and use that. It will be within 10% of the target value, and that is close enough.