#P1403. Summation of Divisor Counts
Summation of Divisor Counts
Summation of Divisor Counts
On the Samuel planet, scientists discovered abundant energy reserves from which the space station's supercomputer Samuel II could operate for long periods. Encouraged by last year's success, Xiao Lian was granted access to Samuel II for mathematical research.
He is studying problems related to divisors. For a positive integer $$N$$, let $$f(N)$$ denote the number of positive divisors of $$N$$. For example, since 12 has divisors 1, 2, 3, 4, 6, 12, we have $$f(12)=6$$. Some sample values are given below:
$$N$$ | 1 | 2 | 3 | 4 | 5 | 6 |
---|---|---|---|---|---|---|
$$f(N)$$ | 1 | 2 | 2 | 3 | 2 | 4 |
Your task is to compute the following summation for a given positive integer $$n$$:
inputFormat
The input contains a single integer $$n$$, where $$1 \le n\le 10^6$$.
outputFormat
Output the value of $$S(n)=\sum_{i=1}^{n} f(i)$$.
sample
1
1