P22029 [HackerRank] Twins
普及
题目描述

Lia is fascinated by anything she considers to be a twin. She calls a pairs of positive integers, $\boldsymbol{i}$ and $j$, twins if:

They are both prime. A prime number is an integer greater than $\mbox{1}$ that has no positive divisors other than $\mbox{1}$ and itself.

Their absolute difference is exactly equal to $2$ (i.e., $|j-i|=2$).

Given an inclusive interval of integers from $n$ to $m$, can you help Lia find the number of pairs of twins there are in the interval (i.e., $[n,m]$)? Note that pairs $(i,j)$ and $(j,i)$ are considered to be the same pair.

Input Format

Two space-separated integers describing the respective values of $n$ and $m$.

Constraints

$1\leq n\leq m\leq10^9$
$m-n\leq10^6$

Output Format

Print a single integer denoting the number of pairs of twins.

Sample Input 0
3 13

Sample Output 0
3

Explanation 0

There are three pairs of twins: $(3,5),(5,7)$, and $(11,13)$.

输入格式

见题面

输出格式

见题面

样例输入
3 13
样例输出
3