Summation program
41% Success8809 Attempts30 Points1s Time Limit256MB Memory1024 KB Max Code
You are given a number \(N\). You are required to determine the value of the following function:
long long int solve(N)
{
ans=0;
for(i=1;i<=N;i++)
ans+=(N/i);
return ans;
}
All divisions are integer divisions(i.e. N/i is actually floor(N/i)).
Input format
- First line: \(T\) denoting the number of test cases
- Each of the next \(T\) lines: An integer \(N\)
Output format
For each test case, print the answer in a new line.
Input Constraints
\(1\le T \le 100 \)
\(1 \le N \le 10^{12}\)
Examples
Input
1 5
Output
10
Explanation
5/1=5
5/2=2
5/3=5/4=5/5=1
Answer=5+2+1+1+1=10
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 Editor...
Results