P2261 [CQOI2007] Remainder Sum
Description
Given positive integers $n$ and $k$, please compute
$$G(n, k) = \sum_{i = 1}^n k \bmod i$$
where $k \bmod i$ denotes the remainder when $k$ is divided by $i$.
Input Format
The input contains a single line with two integers, $n$ and $k$.
Output Format
Output one line with one integer representing the answer.
Explanation/Hint
#### Sample 1 Explanation
$G(10, 5) = 0 + 1 + 2 + 1 + 0 + 5 + 5 + 5 + 5 + 5 = 29$.
#### Constraints
- For 30% of the testdata, it is guaranteed that $n, k \leq 10^3$.
- For 60% of the testdata, it is guaranteed that $n, k \leq 10^6$.
- For 100% of the testdata, it is guaranteed that $1 \leq n, k \leq 10^9$.
------------
Added a set of hack testdata on 2024/2/13.
Translated by ChatGPT 5