 Sum of product of x and y with floor(n/x) = y
Basic Accuracy: 75.24% Submissions: 6197 Points: 1

Given a positive integer n. Find the sum of product of x and y such that floor(n/x) = y .

Example 1:

Input: n = 5
Output: 21
Explanation: Following are the possible
pairs of (x, y):
(1, 5), (2, 2), (3, 1), (4, 1), (5, 1).
So, 1*5 + 2*2 + 3*1 + 4*1 + 5*1
= 5 + 4 + 3 + 4 + 5
= 21.

Example 2:

Input: n = 10
Output: 87
Explanation: Sum of product of all
possible pairs of (x, y) is 87.


You don't need to read or print anything. Your task is to cpmplete the function sumofproduct() which takes n as input parameter and returns the sum of product of all possible pairs(x, y).

Expected Time Complexity: O(n)
Expected Space Compelxity: O(1)

Constraints:
1 <= n <= 106

We are replacing the old Disqus forum with the new Discussions section given below.

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

#### My Submissions:  