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.
 
Your Task:
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 <= 10^{6}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

	def sumofproduct(self, n):

		# Code here

Solutions:
class Solution:

	def sumofproduct(self, n):
		sum = 0
		for i in range(1, n + 1):
			y = int(n / i)
			sum += i * y
			i += 1
		return sum


class Solution:

	def sumofproduct(self, n):
		self.total = 0
		self.i = 1
		self.k = 0
		while self.i <= n:
			self.k = int(n / self.i)
			self.total += self.i * self.k
			self.i += 1
		return self.total


class Solution:

	def sumofproduct(self, n):
		sum = 0
		for i in range(1, n + 1):
			for j in range(1, n + 1):
				if int(n / i) == j:
					sum += i * j
		return sum


class Solution:

	def sumofproduct(self, n):
		c = []
		d = []
		for i in range(1, n + 1):
			c.append(n // i)
			d.append(i)
		s = 0
		for i in range(n):
			s += c[i] * d[i]
		return s


class Solution:

	def sumofproduct(self, n):
		s = 0
		for i in range(1, n + 1):
			x = i
			y = n // x
			s = s + i * y
		return s


class Solution:

	def sumofproduct(self, n):
		total = 0
		for num in range(1, n + 1):
			total += num * (n // num)
		return total


class Solution:

	def sumofproduct(self, n):
		p = 0
		for x in range(1, n + 1):
			y = n // x
			p += x * y
		return p


class Solution:

	def sumofproduct(self, n):
		count = 0
		for x in range(1, n + 1):
			y = int(n / x)
			count += y * x
		return count


class Solution:

	def sumofproduct(self, n):
		ans = 0
		for i in range(1, n + 1):
			ans += i * int(n / i)
		return int(ans)


class Solution:

	def sumofproduct(self, n):
		s = 0
		for i in range(1, n + 1):
			k = n // i
			s += i * k
		return s


class Solution:

	def sumofproduct(self, n):
		ans = []
		for i in range(1, n + 1):
			ans.append(i * (n // i))
		return sum(ans)


class Solution:

	def sumofproduct(self, n):
		a = 0
		for i in range(1, n + 1):
			a += i * (n // i)
		return a


class Solution:

	def sumofproduct(self, n):
		ctr = 0
		for x in range(1, n + 1):
			ctr += x * (n // x)
		return ctr


import itertools
import math

class Solution:

	def sumofproduct(self, n):
		ans = 0
		for i in range(1, n + 1):
			y = int(n / i)
			ans += y * i
		return ans


import itertools
import math

class Solution:

	def sumofproduct(self, n):
		sumnum = 0
		nums = [i for i in range(1, n + 1)]
		combs = [i for i in itertools.product(nums, repeat=2)]
		for i in combs:
			if math.floor(n / i[0]) == i[1]:
				sumnum += i[0] * i[1]
		return sumnum


import math as m

class Solution:

	def sumofproduct(self, n):
		c = 0
		for i in range(1, n + 1):
			c += i * m.floor(n / i)
		return c


import math

class Solution:

	def sumofproduct(self, n):
		sum = 0
		for x in range(1, n + 1):
			sum += x * math.floor(n / x)
		return sum


class Solution:

	def sumofproduct(self, n):
		total = 0
		for itr in range(1, n + 1):
			y = int(n / itr)
			total += itr * y
			itr += 1
		return total
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		n = int(input())
		ob = Solution()
		ans = ob.sumofproduct(n)
		print(ans)


class Solution:

	def sumofproduct(self, n):
		sum = 0
		for i in range(1, n + 1):
			K = n // i
			sum = sum + i * K
		return sum
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		n = int(input())
		ob = Solution()
		ans = ob.sumofproduct(n)
		print(ans)


class Solution:

	def sumofproduct(self, n):
		s = 0
		for i in range(1, n + 1):
			k = int(n / i)
			s = s + i * k
		return s
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		n = int(input())
		ob = Solution()
		ans = ob.sumofproduct(n)
		print(ans)


class Solution:

	def sumofproduct(self, n):
		l = []
		for i in range(1, n + 1):
			y = n // i
			x = i
			l.append([x, y])
		sum = 0
		for j in l:
			p = j[0] * j[1]
			sum = sum + p
		return sum


class Solution:

	def sumofproduct(self, n):
		sum = 0
		for i in range(1, n + 1):
			for j in range(1, n + 1):
				if n // i == j:
					sum += i * j
		return sum
	if '__name__' == '__main__':
		n = int(input())
		print(sumofproduct(n))


class Solution:

	def sumofproduct(self, n):
		sum = 0
		for x in range(n, 0, -1):
			sum += x * int(n / x)
		return sum


class Solution:

	def sumofproduct(self, n):
		sum = 0
		for i in range(1, n + 1):
			p = n // i
			sum = sum + p * i
		return sum


class Solution:

	def sumofproduct(self, n):
		a = []
		b = []
		c = []
		for i in range(1, n + 1):
			a.append(n // i)
			b.append(i)
		for i in range(len(a)):
			c.append(b[i] * a[i])
		return sum(c)


class Solution:

	def sumofproduct(self, n):
		sum1 = 0
		for i in range(1, n + 1):
			y = n // i
			prod = y * i
			sum1 = sum1 + prod
		return sum1


class Solution:

	def sumofproduct(self, n):
		s = 0
		for x in range(1, n + 1):
			if 1 <= int(n / x) <= n:
				s += x * int(n / x)
		return s


class Solution:

	def sumofproduct(self, n):
		a = 0
		for x in range(n):
			b = x + 1
			c = b * (n // b)
			a += c
		return a


class Solution:

	def sumofproduct(self, n):
		l = []
		for x in range(1, n + 1):
			for y in range(1, n + 1):
				if n // x == y:
					l.append([x, y])
		s = 0
		for i in range(len(l)):
			s += l[i][0] * l[i][1]
		return s


class Solution:

	def sumofproduct(self, n):
		ans = n
		for i in range(2, n + 1):
			ans += i * (n // i)
		return ans


class Solution:

	def sumofproduct(self, n):
		k = 0
		for i in range(1, n + 1):
			for j in range(1, n + 1):
				if n // i == j:
					k = k + i * j
		return k