Create a boolean array " isPrime [ 0 . . n ] " and initialize all entries it as true . A value in isPrime [ i ] will finally be false if i is Not a isPrime , else true .
isPrime = [ True ] * ( largest + 1 ) NEW_LINE p = 2 NEW_LINE while p * p <= largest : NEW_LINE