spoj#DIVCNT3. Counting Divisors (cube)
Counting Divisors (cube)
Let $\sigma_0(n)$ be the number of positive divisors of $n$.
For example, $\sigma_0(1) = 1$, $\sigma_0(2) = 2$ and $\sigma_0(6) = 4$.
Let $$S_3(n) = \sum _{i=1}^n \sigma_0(i^3).$$
Given $N$, find $S_3(N)$.
Input
First line contains $T$ ($1 \le T \le 10000$), the number of test cases.
Each of the next $T$ lines contains a single integer $N$. ($1 \le N \le 10^{11}$)
Output
For each number $N$, output a single line containing $S_3(N)$.
Example
Input
5
1
2
3
10
100
Output
1
5
9
73
2302
Explanation for Input
- $S_3(3) = \sigma_0(1^3) + \sigma_0(2^3) + \sigma_0(3^3) = 1 + 4 + 4 = 9$
Information
There are 5 Input files.
- Input #1: $1 \le N \le 10000$, TL = 1s.
- Input #2: $1 \le T \le 300,\ 1 \le N \le 10^{8}$, TL = 20s.
- Input #3: $1 \le T \le 75,\ 1 \le N \le 10^{9}$, TL = 20s.
- Input #4: $1 \le T \le 15,\ 1 \le N \le 10^{10}$, TL = 20s.
- Input #5: $1 \le T \le 2,\ 1 \le N \le 10^{11}$, TL = 20s.
My C++ solution runs in 7.1 sec. (total time)
Source Limit is 12 KB.