human
Find sum of digits in factorial of a number | Function to multiply x with large number stored in vector v . Result is stored in v ..
Calculate res + prev carry.
updation at ith position.
Returns sum of digits in n !.
One by one multiply i to current vector and update the vector ..
Find sum of digits in vector v [ ].
Driver code"
How can the above be solved in Python?
 ... Can you provide a code to find sum of digits in factorial of a number and the other steps required?
assistant
#Here is code to find sum of digits in factorial of a number and the other steps required.
 def multiply ( v , x ) :
	carry = 0
	size = len ( v )
	for i in range ( size ) :
		res = carry + v [ i ] * x
		v [ i ] = res % 10
		carry = res // 10
	while ( carry != 0 ) :
		v . append ( carry % 10 )
		carry //= 10
def findSumOfDigits ( n ) :
	for i in range ( 1 , n + 1 ) :
		multiply ( v , i )
	sum = 0
	size = len ( v )
	for i in range ( size ) :
		sum += v [ i ]
	return sum
if __name__ == " _ _ main _ _ " :
	n = 1000
	print ( findSumOfDigits ( n ) )