A Math Contest P7 - Factors

View as PDF

Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Define f(x) as the number of factors of a positive integer x. Given an integer N, determine \sum_{i=1}^N f(i).

Input Specification

The only line contains an integer, N (1 \le N \le 10^{12}).

Output Specification

Output the value of \sum_{i=1}^N f(i).

Sample Input

5

Sample Output

10

Explanation for Sample

1 has 1 factor: 1.

2 has 2 factors: 1 and 2.

3 has 2 factors: 1 and 3.

4 has 3 factors: 1, 2, and 4.

5 has 2 factors: 1 and 5.

\sum_{i=1}^N f(i) = 1+2+2+3+2 = 10


Comments

There are no comments at the moment.