A huge sum
Practice
5 (1 votes)
Mathematics
Sieve
Hard
Number theory
Factorization
Problem
26% Success 1636 Attempts 50 Points 2s Time Limit 512MB Memory 1024 KB Max Code

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 \)

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
Tags:
Hard
Points:50
Tags:
HardRecruitNumber TheoryReadyGrammar-VerifiedMathematicsSimulationApprovedFactorization
Points:50
5 votes
Tags:
HardNumber TheoryAlgorithmsMathematicsOpenApproved