Finding prime number using sieve of Eratosthenes . Reusing same array as result of above computations in v .
memset ( arr , false , sizeof arr ) ; for ( int p = 2 ; p * p < n ; p ++ ) { if ( arr [ p ] == false ) for ( int i = p * 2 ; i < n ; i += p ) arr [ i ] = true ; }