/**ide
* The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385spa
* The square of the sum of theit
* first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025class
* 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.static
* Find the difference between the sum ofdi
* the squares of the first one hundred natural numbers and the square of the sum.view
*vi
* @author songjie.dongsj 2012-3-26 上午10:22:35auth
*/
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)我推導不出來。。。
之前讀高中最喜歡的就是解數列相關的題。。。