/**

 * The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385

 * The square of the sum of the

 * first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025

 * Hence the difference between the sum of the squares of

 * the first ten natural numbers and the square of the sum is 3025 385 = 2640.

 * Find the difference between the sum of

 * the squares of the first one hundred natural numbers and the square of the sum.

 *

 * @author songjie.dongsj 2012-3-26 上午10:22:35

 */

publicclassProblemSix{

 

    publicstaticvoidmain(String[]args){

        intm=1;

        intsum=0;

        intsum4seriesN=100*(100+1)/2;

        for(;m<100;m++){

            sum+=m*(sum4seriesN-m*(m+1)/2);

        }

        System.out.println(sum4seriesN+" "+sum*2);

    }

}

 

推导了n*m多项式的数列,算是土鳖的方法,不过我还搞了半天,自然数的平方和sum(n)我推导不出来。。。

以前读高中最喜欢的就是解数列相关的题。。。