101955: [AtCoder]ABC195 F - Coprime Present

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $600$ points

Problem Statement

You have $B-A+1$ cards: for each integer from $A$ through $B$, you have one card with that integer written on it. You will give some of them (possibly none) to your pet, Snuke.

Snuke will be happy if, for every pair of different cards, the numbers written on them are pairwise coprime; otherwise, he will be sad.

How many sets of cards will make Snuke happy?

Constraints

  • $1 \leq A \leq B \leq 10^{18}$
  • $B-A \leq 72$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$A$ $B$

Output

Print the number of sets of cards that will make Snuke happy. The constraints guarantee that the answer is less than $2^{63}$.


Sample Input 1

2 4

Sample Output 1

6

You have three cards with $2$, $3$, and $4$ written on them. The following six sets of cards will make Snuke happy:

  • $\{\}$
  • $\{2\}$
  • $\{3\}$
  • $\{4\}$
  • $\{2,3\}$
  • $\{3,4\}$

Sample Input 2

1 1

Sample Output 2

2

The following two sets of cards will make Snuke happy:

  • $\{\}$
  • $\{1\}$

Sample Input 3

123456789000 123456789050

Sample Output 3

2125824

Input

题意翻译

你可以从 $[A, B]$ 中的所有正整数中挑选若干个数组成一个集合,问有多少个集合满足集合中的数两两之间互质,集合大小可以为 $0$ 或 $1$,此时也记录答案。 $1 \le A \le B \le 10^{18}$ $B - A \le 72$ $A, B$ 均为整数

加入题单

上一题 下一题 算法标签: