<<

A Fast Algorithm to Calculate Power Sum of Natural Yuyang Zhu Department of & Physics, Hefei University, Hefei 230601, P. R. China E-mail: [email protected]

Abstract: can be represented as linear combinations of natural numbers with different powers. In this paper, its coefficient matrix and inverse matrix is derived, and the results show the coefficient matrix is a lower triangular matrix while the inverse matrix is upper triangular. Permutations of nth are used to generate the inverse matrix. The generation of natural numbers’ power sum is derived to calculate the power sum. Keywords: sum of natural numbers; generation matrix; generation function; Permutations MR(2000) Subject Classification 11B75, 05A15 1. Introduction The power sum of natural numbers has its applications in and combinatorial mathematics. The existing algorithms of computing power sum includes recursive method, calculus of finite difference, methods of undetermined coefficients and (see [1-7]). This paper proposes a new algorithm by representing as the linear combinatorial of natural numbers with various powers, and deriving its related coefficient matrix. The matrix is proved to be lower triangular, and its inverse matrix is used to derive the generation function of the power sum. Finally the power sum is computed from the generation function.

2. Results n+1 The permutation Pnm+ = m( m + 1) ( m + n ) is a n +1 -th order of m with n+1 nn+1 coefficients, i.e. Pnm+ =m + a1 m + + an m (,,,)a12 a an  Z . By denoting with Pmn+1(), the following result is straightforward to obtain:

Lemma 2.1 There exists an n -th (n  1) order matrix An such that nn−1 ((),(),P12 m P m ,())( Pnn m= m , m , ,) m A .

Proof Since x,,, x2 xn are linearly independent in polynomial P , and

P12( x ), P ( x ), , Pn ( x ) are 1, 2, , n-th order polynomials of x , are also linearly independent in . Obviously both are maximally linear independent sets so they can mutually linear expressed, i.e. there exists an -th order matrix such that nn−1 ((),P12 x P (), x , Pnn ()) x= (, x x , ,) x A . Let xm= and the lemma is proved.

Definition 2.2 Define the -th order matrix as -th order permutation generation matrix. Lemma 2.3 Let A = a be an -th order permutation generation matrix, then n ( ij )nn

(i) If i++ j n 1, then aij = 0 ;

(ii) If i+ j = n +1, then aij =1;

(iii) If i+ j  n +1 and in , then aij=( j − 1) a i j− 1 + a i + 1 j − 1 ;

(iv) If in= , then an i=−( i 1) a n i− 1 . Foundation item: Natural Science Foundation Project of Hefei University (14RC12, 12KY04ZD,2014xk08).

1

nn−1 Proof According to lemma 2.1, ((),(),P12 m P m ,())( Pnn m= m , m , ,) m A , thus nn−1 m= P1( m ) = a 11 m + a 21 m + + an 1 m ,  m( m+ 1) = P ( m ) = a mnn + a m−1 + + a m ,  2 12 22n 2 (2.1)   nn−1 mm(+ 1) ( mn + − 1) = Pmamamn ( ) =12 n + n + + am nn .

According to (2.1), if i++ j n 1, then aij = 0 , (i) holds.

If i+ j = n +1, then aij is an element on the secondary diagonal. According to (2.1),

an1=1, a ( n− 1)2 = 1, , a 1 n = 1, then (ii) holds as well. (iii) and (iv) are proved as follows.

According to (i) and (ii), since Pjj( m )= P−1 ( x )( m + j − 1) , n n−1 n − ( j − 2) n − ( j − 1) Pmamamj−1()= 1( j − 1) + 2( j − 1) + + am ( i − 1)( j − 1) + am i ( j − 1) + + am n ( j − 1) jj−−12 =a(n+ 2 − j )( j − 1) m + a ( n + 3 − j )( j − 1) m + + a n ( j − 1) m ,

Where a(n+ 2 − j )( j − 1) =1. Consider jj−−12 PmPmmjj( )= j−1 ( )( + − 1) = [ a ( n + 2 − j )( j − 1) ma + ( n + 3 − j )( j − 1) m + + ammj n ( j − 1) ]( + − 1) jj−1 =a(njj+−− 2 )( 1) m +[( j − 1) a ( njj +−− 2 )( 1) + a ( njj +−− 3 )( 1) ] m + [( j − 1) a ( njj +−− 3 )( 1)

j−22 +a(n+ 4 − j )( j − 1)] m + + [( j − 1) a ( n − 1)( j − 1) + a n ( j − 1) ] m + ( j − 1) a n ( j − 1) m (2.2) and jj−12 Pj() m= a( njj+ 1 − ) m + a ( njj + 2 − ) m + + a ( nj − 1) m + a nj m . (2.3) By comparing (2.2) and (2.3)

a(n+− 1 j ) j =1, a(n+− 2 j ) j =(j − 1) a(n+ 2 − j )( j − 1) + a ( n + 3 − j )( j − 1) ,

a(n+− 3 j ) j =(j − 1) a(n+ 3 − j )( j − 1) + a ( n + 4 − j )( j − 1) , , a(nj− 1) = (j−+ 1) a(n− 1)( j − 1) a n ( j − 1) ,

anj=−( j 1) a n( j− 1) . Thus (iii) and (iv) hold too. The lemma is proved. 001 01  It is straightforward to find that A = and according to lemma 2.3, A = 0 1 3 . Then 2  3  11  1 1 2 it is trivial to compute the rest: 0 0 0 0 1 0 0 0 0 0 1  0 0 0 1 0 0 0 0 1 15 0 0 0 1 10  0 0 1 6  0 0 0 1 10 85 A4 = , A5 = 0 0 1 6 35 , A = , 0 1 3 11 6  0 0 1 6 35 225 0 1 3 11 50 1 1 2 6 0 1 3 11 50 274 1 1 2 6 24  1 1 2 6 24 120 + Note 1 According to lemma 2.3, n  N,2 n  , An−1 is a lower left submatrix of An . The first row of is a11= a 12 = = a 1(nn− 1) =0, a 1 = 1, and annn =−( 1)!. Thus from known to compute all

2

we need to compute are n − 2elements: a2n,,, a 3 n a ( n− 1) n . They are trivial to compute according to (iii) in lemma 2.3. Similar to the proof of lemma 2.3, we can prove the following : −1 Theorem 2.4 Let An = ()bij n n be the inverse of n -th order permutation generating matrix, then the following conclusions hold:

(i) if i+ j  n +1, then bij = 0 ;

(ii) if i+ j = n +1, then bij =1;

(iii) if ij+ ≤ n and i 1, then bij= − ib i j+ 1 + b i − 1 j + 1; jn+ (iv) if i =1, then b1 j =−( 1) . + −1 −1 Note 2 According to theorem 2.4, n  N,2 n  , An−1 is a upper right submatrix of An . The −1 n -th row of An is

b2n= b 3 n = = b nn =0, b 1 n = 1. 1+n −1 −1 Since b1 1 =−( 1) , to compute An from a known An−1 , all we need to find are elements b21,,, b 31 b (n− 1)1 which are straightforward to get from (iii) of theorem 2.4. [8] ()i ()()()i i i Lemma 2.5 Let Ga{}n be the generation function of number {,,,,}a01 a an

(ik= 1,2, , ) .Then for any constants c12,,, c ck , kk ()()ii G{}{} ci a n= c i G a n . ii==11 nn−−11 Lemma 2.6 If (m , m , ,)((),(), m= P12 m P m ,()) Pnn m A , then nn−−11 (GmGm { }, { }, , Gm { })= ( GPmGPm {12 ( )}, { ( )}, , GPmA {nn ( )}) .

b11 b 12 b 1n  −1 b21 b 22 b 2n i Proof Let A = , and m= b1i P 1()()() m + b 2 i P 2 m + + b ni P n m n   bn12 b n b nn n i (in= 1,2, , ) , then according to theorem 2.4, G{ m }=  bji G { P j ( m )}, and j=1 n n n nn−1 (GmGm { }, { }, , Gm { })= ( bGPmj12 { j ( )},  bGPm j { j ( )}, ,  bGPm jn { j ( )}) j=1 j = 1 j = 1

b11 b 12 b 1n  b21 b 22 b 2n = (G { P12 ( m )}, G { P ( m )}, , G { Pn ( m )})    bn12 b n b nn −1 = (G { P12 ( m )}, G { P ( m )}, , G { Pnn ( m )}) A . n Theorem 2.7 Let G{ Pn ( m )} be the generation function of Pnm+−1 = m( m + 1) ( m + n − 1) , then nx! G{ P ( m )} = . n (1− x )n+1 Proof In the case of n =1,

3

 1  x G{ P ( m )}= G { m } = mxmm−1 = x x = x = . 1  2 mm==111−−xx (1 )

The theorem holds. Assuming that in the case of nk=−1 the theorem also holds, i.e. G{ Pk−1 ( m )} (kx− 1)! = , then (1− x )k

xx tGPmdtk−22{ ( )}= mm ( + 1) ( mk + − 1) t m + k − dt 00k  m=1  (kx− 1)! = m( m+ 1) ( m + k − 2) xm+ k −1 = x k − 1 G { P ( m )} = x k − 1 ,  k−1 k m=1 (1− x ) Take derivatives to both sides of the equation:

 k−1 kk−−21(k− 1)! x k ! x . x G{ Pk ( m )} == x kk+1 (1−−xx ) (1 ) kx! Namely G{ P ( m )} = , so the theorem also holds in the case of nk= . According to the principle k (1− x )k+1 of , the theorem is proved. k [8] Ga{}k Lemma 2.8 If baki=  , then Gb{}k = . i=0 1− x 3. The algorithm to compute power sum of natural numbers −1 To compute the power sum, the first step is to compute the inverse matrix An of n -th order permutation generating matrix An , according to theorem 2.4 and mathematical software. The second step is to find the generation function G{ kt }( t= 1,2, , n ) according to lemma 2.6 and theorem 2.7. The third s t step is to find the generation function of aks =  according to lemma 2.8. The last step is to calculate k=1 n the x coefficients of generation function Ga{}s of as . The computation is now complete. n Example 3.1 Compute  k 4 . k =1 0 0 0 1 −−1 1 1 1   0 0 1 6 7− 3 1 0 Solution Since A = , its inverse A−1 = , and according to 4 0 1 3 11 4 −6 1 0 0   1 1 2 6 1 0 0 0 lemma 2.6 and theorem 2.7, x2! x 3! x 4! x (1+ 11x + 11 x23 + x ) x Gk{4 }= ( − 1) + 7  + ( − 6) + 1  = . (1−x )2 (1 − x ) 3 (1 − x ) 4 (1 − x ) 5 (1− x )5 n 4 Let akn =  , and according to lemma 2.8, k=1 Gk{}4 (1+ 11x + 11 x23 + x ) x  k + 5 Ga{}== =(x + 11 x2 + 11 x 3 + x 4 ) xk . n 6  1− x (1− x ) k=0 k The coefficients are

4

n+4   n + 3   n + 2   n + 1  n( n+ 1)(2 n + 1)(3 n2 + 3 n − 1)  +11   + 11   +   = . n−1   n − 2   n − 3   n − 4  30 Thus n n( n+ 1)(2 n + 1)(3 n2 + 3 n − 1)  k 4 = . k =1 30 n Example 3.2 Compute  k12 . k =1 −1 Solution Since A12 = −1 1 − 1 111 − − 111111 − −  2047− 1023 551 − 255 127 − 63 31 − 15 7 − 3 1 0 −86526 28510 − 9330 3025 − 966 301 − 90 25 − 6 1 0 0  611501− 145750 34105 − 7770 1701 − 350 65 − 10 1 0 0 0 −1379400 246730 − 42525 6951 − 1050 140 − 15 1 0 0 0 0  1323652− 179487 22827 − 2646 266 − 21 1 0 0 0 0 0 −627396 63987 − 5880 462 − 28 1 0 0 0 0 0 0  159027−− 11880 750 36 1 0 0 0 0 0 0 0  −−22275 1155 45 1 0 0 0 0 0 0 0 0  1705 − 55 1 0 0 0 0 0 0 0 0 0   − 66 1 0 0 0 0 0 0 0 0 0 0   1 0 0 0 0 0 0 0 0 0 0 0 According to lemma 2.6 and theorem 2.7, x2! x 3! x 4! x 5! x Gk{12 }= ( − 1) + 2047 + ( −86526) + (611501) + ( − 1379400) (1−x )2 (1 − x ) 3 (1 − x ) 4 (1 − x ) 5 (1 − x ) 6 6!x 7! x 8! x 9! x + (1323652) + ( −627396) + 159027 + ( − 22275) (1−x )7() 1 − x 8 (1 − x ) 9 (1 − x ) 10 10!x 11!xx 12! + 1705 +( − 66) + (1− x )11(1−−xx ) 12 (1 ) 13 1 =[x (1 + 4083 x + 478271 x2 + 10187685 x 3 + 66318474 x 4 + 162512286 x 5 (1− x )13 +162512286x6 + 66318474 x 7 + 10187685 x 8 + 478271 x 9 + 4083 x 10 + x 11 )]. n 12 Let akn =  , and according to lemma 2.8, k=1 Gk{12 } 1 G{ a }= = [ x (1 + 4083 x + 478271 x2 + 10187685 x 3 + 66318474 x 4 + 162512286 x 5 n 1−−xx (1 )14 + 162512286x6 + 66318474 x 7 + 10187685 x 8 + 478271 x 9 + 4083 x 10 + x 11 )] =(x + 4083 x2 + 478271 x 3 + 10187685 x 4 + 66318474 x 5 + 162512286x6 + 162512286 x 7 + 66318474 x 8

 9 10 11 12 k +13 k ++ 10187685xx++ 478271 4083x x )x . k=0 k

5

The xn coefficients on the right hand side are n+12   n + 11   n + 10   n + 9   +4083   +478271   +10187685   + n−1   n − 2   n − 3   n − 4 

n+8   n + 7   n + 6   n + 5  66318474 + 162512286   + 162512286   + 66318474   n−5   n − 6   n − 7   n − 8  n+4   n + 3   n + 2   n + 1  . +10187685 +478271   +4083   +   n−9   n − 10   n − 11   n − 12  691n 5 n3 33 n 5 22 n 7 11 n 9 n 12 n13 = − + − + − +n11 + + . 2730 3 10 7 6 2 13

n 691n 5 n3 33 n 5 22 n 7 11 n 9 n 12 n 13 Thus k12 = − + − + − +n11 + + . k=1 2730 3 10 7 6 2 13

−1 Note 3 According to Note 2, If the n -th order inverse of permutation generation matrix An , then −1 for arbitrary natural number m (1≤ m ≤ n ), Am is upper right triangular submatrix of . Thus if

k has been computed, then the power sum im can be computed for arbitrary ( ≤ ≤ ). For example, i=1 k k 12 −1 11 i can be calculated by the first column of A12 , i can be calculated by the second column of , i=1 i=1 k k i10 can be calculated by the third column of , i9 can be calculated by the fourth column of , i=1 i=1 k and i4 can be calculated by the ninth column of . This algorithm is straightforward to implement i=1 k on the computer, i.e. i50 can be calculated in a few minutes on Mathematics. i=1

References

[1] CHEN Jing-run, LI Jian-yu. In S k (n) of the new results[J]. Chinese Science Bulletin, 1986, 31. 6. [2] Joseph H. Silverman. A Friendly Introduction to [M]. Prentice Hall , Third Edition, 2006. [3] Johnson, A.Jerry. Summing the Powers of the Using Caculus [J ]. Mathematics Teacher 79 (March 1986). [4] ZHU Wei-yi. A Recurrence Formula of the Coefficient of the Sum of Natural Number′s Power[J]. Mathematics in practice and theory, Vol.34, No.10:170-173. (in Chinese) [5] Hua luo-geng. Introduction to Number Theory[M]. Science Press (in Chinese), 1979. [6] CHEN Jing-run, LI JIan-yu. About the Power Sum of the Natural Number[J]. Journal of Xiamen University, 1984, 23(2). [7] CHEN Jing-run, LI JIan-yu. About General Properties of the Power Sum the Formula[J]. Journal of Mathematical Research and Exposition,1986,6(1):43-49. (in Chinese) [8] Yinlong XU, Shuling SUN. Introduction to Combinatorial Mathematics [M], University of Science and Technology of China Press, 2010, 2:175-179.

6