Sum of product of x and y with floor(n/x) = y
Submissions: 1433   Accuracy:

58.59%

  Difficulty: Basic   Marks: 1

Given a positive integer n. The task is to find the sum of product of x and y such that floor(n/x) = y .

Examples:

Input : n = 5
Output : 21
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.

Input : n = 10
Output : 87


Input:
The first line of input contains an integer T. The T test cases follow . Each test case contains an integer N.

Output:
For each test case in a new line print the required output.


Constraints:
1<=T<=100
1<=N<=106

Example:
Input:

2
5
10
Output:
21
87

** For More Input/Output Examples Use 'Expected Output' option **

Author: Shubham Joshi 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.