Implement prime solver.