Solve next prime problem