`
tosee
  • 浏览: 4919 次
  • 性别: Icon_minigender_1
最近访客 更多访客>>
社区版块
存档分类
最新评论
阅读更多
Problem 6
The sum of the squares of the first ten natural numbers is,
1^2 + 2^2 + ... + 10^2 = 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.

分析1:一组数和的平方与平方的和的差是这组数两两相乘的积的和的二倍;

分析2:写出上面和的形式

1x2 1x3 1x4 ...   =   1x(2+3+4+...)

      2x3 2x4 ...   =   2x(3+4+...)

            3x4 ...   =   3x(4+...)

...

    99x100    ...   =  99x(100)

这样的形式可以看出,采用倒序求和的方式,将只使用一个循环就可以求出和。

但有没有更好的方式呢?

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics