#P1835. Count Primes in a Range
Count Primes in a Range
Count Primes in a Range
You are given two integers L and R. Your task is to count the number of prime numbers in the interval [L, R].
The constraints are given as follows:
- $1 \leq L \leq R < 2^{31}$
- $R-L \leq 10^6$
Note: A prime number is a number greater than 1 that has no positive divisors other than 1 and itself.
inputFormat
The input consists of a single line with two space-separated integers L and R.
For example:
1 10
outputFormat
Output a single integer representing the number of prime numbers in the interval [L, R].
For the sample input above, the output should be:
4
sample
1 10
4