Atenţie! Aceasta este o versiune veche a paginii, scrisă la 2016-01-25 06:37:55.
Revizia anterioară   Revizia următoare  

Problem: prime number generator

Cosmin
Cosmin Negruseri
25 ianuarie 2016

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.

Categorii: