Posts

Showing posts with the label summation of primes

Summation of primes | Project Euler | Problem #10

URL to the problem page:  https://projecteuler.net/problem=10 The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. #include   <iostream> using   namespace   std ; int   main () {      long   long  sum =  0 , counter, i, j;      for  (i =  3 ; i <  2000000 ; i +=  2 ) {         counter =  0 ;          for  (j =  2 ; j <=  sqrt (i); j++) {              if  (i % j ==  0 ) {                 counter++;              ...
My photo
Ercan Tomac
instagram.com/ercantomac