Given an integer n, calculate the total sum of all combinations C(i,j), where (1<=i<=n && 1<=j<=n) and where
C(i,j) = i mod j + j mod i. Since the result can be very large, return the final sum modulo (10^9 + 7)
Function: int solve(int n)
Example:
int n = 3
C(3,3) = 3 mod 3 + 3 mod 3 = 0 + 0 = 0
C(3,2) = 3 mod 2 + 2 mod 3 = 1 + 1 = 2
C(3,1) = 3 mod 1 + 1 mod 3 = 2 + 2 = 4
C(2,3) = 2 mod 3 + 3 mod 2 = 1 + 1 = 2
C(2,2) = 2 mod 2 + 2 mod 2 = 0
C(2,1) = 2 mod 1 + 1 mod 2 = 1 + 1 = 2
C(1,3) = 1 mod 3 + 3 mod 1 = 4
C(1,2) = 1 mod 2 + 2 mod 1 = 2
C(1,1) = 1 mod 1 + 1 mod 1 = 0
TotalSum = 0+2+4+2+0+2+4+2+0 = 16
Unfortunately i don't have the constrains, but O(n^2) won't work for sure.