#C12620. Sum of Primes
Sum of Primes
Sum of Primes
Given an integer n
, your task is to compute the sum of all prime numbers less than n
using the Sieve of Eratosthenes algorithm.
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Formally, if we let \(P\) be the set of all prime numbers less than \(n\), then you must compute \(\sum_{p \in P} p\).
If n
is less than or equal to 2, the answer is 0.
inputFormat
The input consists of a single integer n
provided on a line (read from STDIN).
outputFormat
Output a single integer – the sum of all prime numbers less than n
(printed to STDOUT).
10
17
</p>