Finished functions related to primes