Ottimo punto di partenza:
http://it.wikipedia.org/wiki/Crivello_di_Eratostene