projecteuler---->problem=6----Sum square difference
来源:互联网 发布:微博数据抓取 编辑:程序博客网 时间:2024/05/21 23:00
title:
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.
前十个正整数的平方和是:12 + 22 + ... + 102 = 385
前十个正整数的和的平方是:(1 + 2 + ... + 10)2 = 552 = 3025
因此前十个正整数的和的平方,与前十个正数整数的平方和,的差是2640。
现在请你求出前一百个正整数的和的平方与前一百个正整数的平方和的差。
解答:
a,b=0,0m=100for i in range(1,m+1):a += pow(i,2)b = pow((1+m)*m/2,2)print b-a
0 0
- projecteuler---->problem=6----Sum square difference
- Problem 6 Sum square difference
- 【Project Euler】【Problem 6】Sum square difference
- (Problem 6)Sum square difference
- Problem 6 Sum square difference (数学)
- Project Euler Problem 6: Sum square difference
- PE 6 Sum square difference
- projecteuler---->problem=13----Large sum
- projecteuler---->problem=16----Power digit sum
- projecteuler---->problem=20----Factorial digit sum
- 6 Sum square difference - Project Euler
- projecteuler---->problem=18----Maximum path sum I
- 欧拉计划(6)Sum square difference
- https://projecteuler.net/problem=6
- ProjectEuler-Problem 16-Power digit sum
- Project Euler 006 Sum square difference
- http://projecteuler.net/problem=6 [Answer:25164150]
- http://projecteuler.net/problem=6 【参考解法】
- HDU 1241 Oil Deposits
- 新浪show虚拟视频 v3.1 官方版
- 一个线程池的简单的实现
- 淘宝在hbase中的应用和优化
- Linux Wireless架构总结--wifi的数据通路
- projecteuler---->problem=6----Sum square difference
- 小月慌忙四处寻找小梅
- 配置applicationContext.xml
- LeetCode: Set Matrix Zeroes [073]
- ant build.xml详解
- iOS中UIImageview笔记
- 浅夏如风
- Json相关
- 陌陌电脑版怎么安装