Prime number functions in Python