#K95677. Prime Count and Sum

    ID: 38917 Type: Default 1000ms 256MiB

Prime Count and Sum

Prime Count and Sum

Given two integers (a) and (b), your task is to determine the number of prime numbers in the interval ([a, b]) (inclusive) as well as the sum of all the primes in that range.

The sum of primes can be represented as (\sum_{p \in P} p), where (P) is the set of primes between (a) and (b). An efficient method, such as the Sieve of Eratosthenes, is recommended to compute the primes within the interval.

inputFormat

The input is given in a single line containing two space-separated integers (a) and (b) ((1 \leq a \leq b \leq 10^6)), which specify the inclusive range in which to count the prime numbers.

outputFormat

Output a single line with two space-separated integers: the first is the count of prime numbers in the range ([a, b]) and the second is the sum of these prime numbers.## sample

10 20
4 60

</p>