Revizia anterioară Revizia următoare
Problem: prime number generator
A while back Ovidiu Gheorgheoiu told me this neat problem:
How would you build an efficient prime number generator. Let's call a generator an object that has one method: getNextPrime(). When we call it the first time it returns 2 and every time we call it again it will return the next prime number not returned yet.