Generating prime numbers using python