Implemented prime() function