luogu#P2261. [CQOI2007] 余数求和

[CQOI2007] 余数求和

Problem Description

Given positive integers nn and kk, please compute

G(n,k)=i=1nkmodiG(n, k) = \sum_{i = 1}^n k \bmod i

where kmodik \bmod i denotes the remainder when kk is divided by ii.

Input Format

The input contains a single line with two integers, nn and kk.

Output Format

Output one line with one integer representing the answer.

10 5

29

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,k103n, k \leq 10^3.
  • For 60% of the testdata, it is guaranteed that n,k106n, k \leq 10^6.
  • For 100% of the testdata, it is guaranteed that 1n,k1091 \leq n, k \leq 10^9.

Added a set of hack testdata on 2024/2/13.

Translated by ChatGPT 5