Codeforces Round 752 (Div. 2)
F
Artistic Partition
Codeforces
未评级
原题
← E→
翻译中…

For two positive integers $l$ and $r$ ($l \le r$) let $c(l, r)$ denote the number of integer pairs $(i, j)$ such that $l \le i \le j \le r$ and $\operatorname{gcd}(i, j) \ge l$. Here, $\operatorname{gcd}(i, j)$ is the greatest common divisor (GCD) of integers $i$ and $j$.

翻译中…

YouKn0wWho has two integers $n$ and $k$ where $1 \le k \le n$. Let $f(n, k)$ denote the minimum of $\sum\limits_{i=1}^{k}{c(x_i+1,x_{i+1})}$ over all integer sequences $0=x_1 \lt x_2 \lt \ldots \lt x_{k} \lt x_{k+1}=n$.

翻译中…

Help YouKn0wWho find $f(n, k)$.

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \le t \le 3 \cdot 10^5$) — the number of test cases.

翻译中…

The first and only line of each test case contains two integers $n$ and $k$ ($1 \le k \le n \le 10^5$).

翻译中…

Output

翻译中…

For each test case, print a single integer — $f(n, k)$.

翻译中…

Note

翻译中…

In the first test case, YouKn0wWho can select the sequence $[0, 2, 6]$. So $f(6, 2) = c(1, 2) + c(3, 6) = 3 + 5 = 8$ which is the minimum possible.

翻译中…

样例

Input #1
4
6 2
4 4
3 1
10 3
Output #1
8
4
6
11
InputCopy OutputCopy
题目信息
题号
1604F
时间限制
3 s
内存限制
1024 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。