POWER SUMMATION :')
Author: Nazmul Alam
Leeana Learned Few New Things Few Days Ago , Like:
- Find The Summation Of Divisors With Prime Factorization
- Modular Arithmetic
So Now Her Uncle Gave Her A Task.
Task Is: You Will Be Given A Number(N) And Another Number(K). Now You Have To Find Kth Power Summation Of Divisors.
Summation Of Divisors Will Be Huge, So You Need To Print The Summation Module (M=1000000007).
Like: Divisors Of 6 is: ( 1 2 3 6 ) And K = 2.
so, summation is: 1^K+2^K+3^K+6^K = 1^2 + 2^2 + 3^2 + 6^2= 1+4+9+36 = 50%1000000007=50
Leeana Thinks That You Are A Great Programmer, So She Needs Your Help. Can You Help Her??? :D :D :D
Input Format
Input Starts With An Integer 1<=T<=500, Denoting The Number Of Test Cases. Each Case Contains An Integer The Number 1<=N<=10^15 and An Integer 1<=K<=10^5 Denoting The Power Of Divisors.
Output Format
For Each Case, Print The Case Number And Kth Power Summation Of Divisors Of N Module 1000000007. After Each Case Print A New Line. See Sample Input And Output For Better Explanation. :)
Samples
Input
Output
Explanation: case 1: 1^2+2^2+3^2+6^2=50%1000000007=50 case 2: 1^1+2^1+3^1+6^1=12%1000000007=12 case 3: 1^4+2^4+3^4+6^4=1394%1000000007=1394 case 4: 1^3+2^3+3^3+6^3=252%1000000007=252
Language | Time | Memory |
GNU C 11 | 2s | 1024MB |
GNU C++ 14 | 2s | 1024MB |
GNU C++ 11 | 1s | 512MB |