Problem 48
The series, 1 1 + 2 2 + 3 3 +...+ ten ten =10405071317 .
Find the last ten digits of the series, 1 1 + 2 2 + 3 3 +...+ the .
Answer:
9110846700
Completed on Thu, Jul 2015, 17:26
Initial thinking, you can use the method of meta-pair to calculate the number of times each number needs to multiply
def func (a): forIinchRange0,Len(a)):aI [1]*=aI [0]return aa=[[i,i] forIinchRange +,0,-1)]result=0 while Len(a) >0:result+=a. Pop () [1]a=func (a) Print (result% (POW (Ten,Ten)))
Further, you can use the array subscript to get the number of multiply
def func (a): forIinchRange0,Len(a)):a[i]=a[I]* ( +-I.)return aa=[i forIinchRange +,0,-1)]result=0 while Len(a) >0:result+=a. Pop ()a=func (a) Print (result% (POW (Ten,Ten)))
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Eularproject 48: Summing with arrays