Sum of GCDs
Submissions: 562   Accuracy:

4.17%

  Difficulty: Easy   Marks: 2

Given an integer N, find the sum of GCD(i, N) where i = 1 to N. GCD denotes the greatest common divisor. Provide the answer modulus 10^9 + 7.

Input:

The first line of the input contains an integer T denoting the number of test cases. Then T test cases follow. Each test cas consists of a single line containing an integer N.


Output:
For each test case, output the sum in seperate line.

Constraints:
1<=T<=5000
1<=N<=1000000


Example:

Input:
2
2
10

Output:
3
27

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Raju Varshney
Author: AdityaChatterjee


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.