#K93187. Sum of Primes

    ID: 38364 Type: Default 1000ms 256MiB

Sum of Primes

Sum of Primes

Given an integer N, compute the sum of all prime numbers in the range \(1 \leq p \leq N\).

A prime number is a natural number greater than 1 that has no divisors other than 1 and itself. An efficient method to find all primes up to \(N\) is to use the Sieve of Eratosthenes. After determining the prime numbers, output the sum of these primes.

inputFormat

The input consists of a single integer (N) ((1 \leq N \leq 10^6)) which represents the upper bound of the range.

outputFormat

Output a single integer representing the sum of all prime numbers from 1 to (N).## sample

10
17

</p>