P7586 [COCI 2012/2013 #1] SNAGA

Description

Starting from a positive integer $N$, find the smallest positive integer that is not divisible by $N$. If we repeat this process using the obtained positive integer, we will eventually get $2$. Define $\operatorname{strength}(N)$ as the length of the resulting sequence. For example, for $N = 6$, we can obtain the sequence $6,4,3,2$, which consists of $4$ numbers, so $\operatorname{strength}(6) = 4$. Given two positive integers $A, B$, compute: $$ \sum\limits_{i=A}^B \operatorname{strength}(i)$$

Input Format

The input consists of one line containing two integers $A, B$ separated by a space.

Output Format

Output one integer on a single line, representing the result.

Explanation/Hint

#### Constraints For $100\%$ of the testdata, it is guaranteed that $3 \le A < B \le 10^{17}$. #### Notes The scoring for this problem follows the original COCI settings, with a full score of $140$. Translated from **[COCI2012-2013](https://hsin.hr/coci/archive/2012_2013/) [CONTEST #1](https://hsin.hr/coci/archive/2012_2013/contest1_tasks.pdf)** ___T5 SNAGA___. Translated by ChatGPT 5