Calculate sum of prime numbers and store them in sum_prime array . sum_prime [ i ] stores sum of prime numbers from primes [ 0 ] to primes [ i - 1 ]
sum_prime [ 0 ] = 0 ; for ( int i = 1 ; i <= primes . size ( ) ; i ++ ) sum_prime [ i ] = primes [ i - 1 ] + sum_prime [ i - 1 ] ;