Implement prime number generation