Set all numbers as prime memset ( prime , true , sizeof ( prime ) )
prime [ 0 ] = False NEW_LINE prime [ 1 ] = False NEW_LINE for p in range ( 2 , N + 1 ) : NEW_LINE INDENT if p * p > N : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT