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.

这第六题python实现最简单吧

max1 = 100

sum1 = 0
sum2 = 0
for i in range(1,max1+1):
sum1 += i**2 sum2 = ((1+max1)*max1/2)**2
print(sum2-sum1)

  

Problem 6: Sum square difference的更多相关文章

  1. (Problem 6)Sum square difference

    Hence the difference between the sum of the squares of the first ten natural numbers and the square ...

  2. projecteuler Sum square difference

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

  3. Sum square difference

    简单: e sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square o ...

  4. (Problem 57)Square root convergents

    It is possible to show that the square root of two can be expressed as an infinite continued fractio ...

  5. Project Euler 44: Find the smallest pair of pentagonal numbers whose sum and difference is pentagonal.

    In Problem 42 we dealt with triangular problems, in Problem 44 of Project Euler we deal with pentago ...

  6. Porject Euler Problem 6-Sum square difference

    我的做法就是暴力,1+...+n 用前n项和公式就行 1^2+2^2+....+n^2就暴力了 做完后在讨论版发现两个有趣的东西. 一个是 (1+2+3+...+n)^2=(1^3)+(2^3)+(3 ...

  7. [LeetCode&Python] Problem 404. Sum of Left Leaves

    Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two l ...

  8. [LeetCode&Python] Problem 530. Minimum Absolute Difference in BST

    Given a binary search tree with non-negative values, find the minimum absolute difference between va ...

  9. [LeetCode&Python] Problem 371. Sum of Two Integers

    Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Exam ...

随机推荐

  1. 关于display的属性:block和inline-block以及inline的区别,float相关说明

    首先是block和inline的区别,说通俗点block就是让其形成块级元素,而且其前后都会有换行符:而inline的话就是让元素设置为内联样式(对其设置的宽高都没有什么卵用,不产生效果,但是颜色效果 ...

  2. Kinect外包-就找北京动点飞扬软件(长年承接微软Kinect体感项目外包,有大型Kinect案例)

    承接Kinect体感企业项目.游戏项目外包 有丰富案例提供演示,可公对公签正规合同,开发票. 我们是北京的公司.专业团队,成员为专业WPF产品公司一线开发人员,有大型产品开发经验: 提供优质的售后服务 ...

  3. Vim里常见的几个不可见字符

    Vim里常见的几个不可见字符:^@ = 0x00 Null值^I = 0x09 水平制表^J = 0x0A 换行^M = 0x0D 回车

  4. 压测过程中使用nmon对服务器资源的监控

    1.nmon工具的下载和安装: 官网:http://nmon.sourceforge.net/pmwiki.php 下载完成后进行解压,更改权限:chmod 777 2.查看linux系统的版本,再使 ...

  5. 融云(API)

    先记录下融云API地址:真是难找 IMKit: https://www.rongcloud.cn/docs/api/android/imkit/index.html IMLib: https://ww ...

  6. final model for bioinformatics

    final model for bioinformatics 模拟真实的生物系统,从有机分子到细胞,到组织,到器官,到个体,到家系,到群体. 正确的设计结构,可拓展性,可塑性. 良好的可视化. 面向对 ...

  7. jmeter进行简单性能测试

    本文使用jmeter做一个简单的压力测试. 压力测试的步骤:1.录制脚本或编写脚本:2.自定义参数:3.场景设计:4.使用控制器模拟用户:5.使用监听,查看测试结果 以10个用户登录http://ww ...

  8. Robot Framework--BuiltIn库4

    Catenate :关键字可以连接多个信息. Create List :关键字可以定义列表. get time :获取当前时间. Evaluate :数值运算并得到结果: Should系列关键字是Sh ...

  9. ie11兼容

    项目里遇到ie11的问题, 1.控制台报:SCRIPT7002: XMLHttpRequest: 网络错误 0x80070005, 拒绝访问. 后来发现是由于传参过长,不应该用get请求,后改成pos ...

  10. xibai的PCI卡在英文系统上安装报错

    通过购买时自带的光驱,在里面直接找相对应的型号的驱动,直接安装,即可 不要通过电脑管理,然后更新驱动的这种方式,会报错