#C8640. Sum of Primes Up to N

    ID: 52645 Type: Default 1000ms 256MiB

Sum of Primes Up to N

Sum of Primes Up to N

Given a positive integer \( n \), your task is to compute the sum of all prime numbers between 1 and \( n \) (inclusive). A prime number is a number greater than 1 that has no positive divisors other than 1 and itself. In mathematical terms, a number \( i \) is prime if it satisfies:

[ \text{if } i > 1 \text{ and } \forall d \ (2 \leq d \leq \sqrt{i}),; i \bmod d \neq 0 ]

For example, when \( n = 10 \), the prime numbers are 2, 3, 5, and 7, and their sum is 17.

Your solution should read from STDIN and print the result to STDOUT.

inputFormat

A single integer ( n ) (where (1 \leq n \leq 10^5)) provided via standard input.

outputFormat

Print a single integer representing the sum of all prime numbers from 1 to ( n ) (inclusive) to standard output.## sample

10
17