A huge sum

5

1 votes
Mathematics, Sieve, Hard, Number Theory, Factorization
Problem

Let D(n) denote the number of divisors of n. D(1)=1,D(6)=4.

Let F(N,K)=i=1ND(iK)

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
1T104
1N,K107

Sample Input
2
3 1
5 2
Sample Output
5
15
Time Limit: 2
Memory Limit: 512
Source Limit:
Explanation

In the first case, answer is D(1)+D(2)+D(3)=1+2+2=5.
In second case, answer is D(12)+D(22)+D(32)+D(42)+D(52)=1+3+3+5+3=15

Editor Image

?