| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 28 | 14 | 11 | 52.381% |
For any positive integer $n$, define $s(n)$ as the smallest positive integer $m$, whose factorial\footnote{The factorial of a positive integer $m$ (denoted as $m!$) is the product of all integers from 1 to $m$: $$ m! := 1\cdot 2 \cdot 3 \cdot \ldots \cdot m. $$ is divisible by $n$.
For example, $$\begin{align*} s(1) &= 1,\\ s(2) &= 2,\quad \text{(because $1!$ (=1) is not divisible by 2, but $2!$ (=2) is)}\\ s(4) &= 4,\quad \text{($3!$ (=6) is not divisible by 4, but $4!$ (=24) is)}\\ s(6) &= 3,\quad \text{($3!$ (=6) is divisible by 6)}\\ s(9) &= 6,\quad \text{($6!$ (=720) is divisible by 9)}\\ s(10) &= 5,\quad \text{etc}\\ \end{align*}$$
The task is, given two integers $A$ and $B$, to find the sum:
$$s(A) + s(A+1) + \ldots + s(B).$$
The single line of input contains two space-separated integers: $A$ and $B$ ($1 \le A \le B \le 1\,000\,000$).
The first and only line of output should contain the required sum.
5 10
30
The answer is $s(5) + s(6) + s(7) + s(8) + s(9) + s(10) = 5 + 3 + 7 + 4 + 6 + 5 = 30$.