Let \(D(n)\) denote the number of divisors of n. \(D(1) = 1, D(6) = 4\).
Let \( F(N,K) = \displaystyle \sum_{i=1}^{N} D \left(i^K \right)\)
You are given T tasks. Each task contains two integers, N and K. You have to output \(F(N,K)\) modulo 10^9 + 7 for every task.
Input
First line contains a single integer T, the number of tasks.
Each of the next T lines contain two integers separated by a space, N, and K respectively.
Output
For each task, print \(F(N,K)\) modulo 10^9 + 7 on a new line .
Constraints
\(1 \leq T \leq 10^4\)
\( 1 \le N,K \le 10^7 \)
In the first case, answer is \(D(1) +D(2)+D(3) = 1 + 2 + 2 = 5\).
In second case, answer is \(D(1^2)+D(2^2)+D(3^2)+D(4^2)+D(5^2) = 1 + 3 + 3 + 5 + 3 = 15\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor