#B3840. Counting Prime Numbers in an Interval

    ID: 11497 Type: Default 1000ms 256MiB

Counting Prime Numbers in an Interval

Counting Prime Numbers in an Interval

A positive integer greater than \(1\) is called a prime number if it is divisible only by \(1\) and itself. In mathematical terms, an integer \(n > 1\) is prime if and only if there is no integer \(d\) with \(1 < d < n\) such that \(d|n\). Given two positive integers \(A\) and \(B\), your task is to determine the number of prime numbers in the interval \([A, B]\) (inclusive).

inputFormat

The input consists of two positive integers \(A\) and \(B\) (\(A \leq B\)), separated by whitespace.

outputFormat

Output a single integer representing the count of prime numbers between \(A\) and \(B\) inclusive.

sample

1 10
4