implemented factorial and is_prime functions