human
Sum of products of all combination taken ( 1 to n ) at a time | Find the postfix sum array.
Modify the array such that we don 't have to compute the products which are obtained before.
Finding sum of all combination taken 1 to N at a time.
sum taken 1 at time is simply sum of 1 - N.
for sum of products for all combination.
finding postfix array.
sum of products taken i + 1 at a time.
modify the array for overlapping problem.
Driver 's Code.
storing numbers from 1 to N.
calling allCombination"
Solution in Python:
 Give me a code to sum of products of all combination taken ( 1 to n ) at a time and the other steps required?
assistant
#Here is code to sum of products of all combination taken ( 1 to n ) at a time and the other steps required.
 def postfix ( a , n ) :
	for i in range ( n - 1 , 1 , - 1 ) :
		a [ i - 1 ] = a [ i - 1 ] + a [ i ]
def modify ( a , n ) :
	for i in range ( 1 , n ) :
		a [ i - 1 ] = i * a [ i ] ;
def allCombination ( a , n ) :
	sum = 0
	for i in range ( 1 , n + 1 ) :
		sum += i
	print ( " f ( 1 ) ▁ - - > ▁ " , sum )
	for i in range ( 1 , n ) :
		postfix ( a , n - i + 1 )
		sum = 0
		for j in range ( 1 , n - i + 1 ) :
			sum += ( j * a [ j ] )
		print ( " f ( " , i + 1 , " ) ▁ - - > ▁ " , sum )
		modify ( a , n )
if __name__ == " _ _ main _ _ " :
	n = 5
	a = [ 0 ] * n
	for i in range ( n ) :
		a [ i ] = i + 1
	allCombination ( a , n )