removes nonprimes from
candidates
{
nextmultiple = 2 * factor;
while (nextmultiple <= n)