human
Write me a code to sum of product of x and y such that floor ( n / x ) = y and the other steps required given the following:
Sum of product of x and y such that floor ( n / x ) = y | Return the sum of product x * y.
Iterating x from 1 to n.
Finding y = n / x ..
Adding product of x and y to answer ..
Driven Program"
How can the above be solved in Python?
assistant
#Here is code to sum of product of x and y such that floor ( n / x ) = y and the other steps required.
 def sumofproduct ( n ) :
	ans = 0
	for x in range ( 1 , n + 1 ) :
		y = int ( n / x )
		ans += ( y * x )
	return ans
n = 10
print ( sumofproduct ( n ) )