Main logic of Sundaram . Mark all numbers which do not generate prime number by doing 2 * i + 1
i = 1 NEW_LINE while i <= ( ( math . sqrt ( MAX ) - 1 ) / 2 ) : NEW_LINE INDENT j = ( i * ( i + 1 ) ) << 1 NEW_LINE while j <= MAX / 2 : NEW_LINE INDENT marked [ j ] = 1 NEW_LINE j = j + 2 * i + 1 NEW_LINE DEDENT i = i + 1 NEW_LINE DEDENT