Problem 6 Sum square difference
来源:互联网 发布:影集软件 编辑:程序博客网 时间:2024/05/22 13:45
The sum of the squares of the first ten natural numbers is,
The square of the sum of the first ten natural numbers is,
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.
import mathdef run(n): square_sum = n*(n+1)*(2*n+1)/6 sum_square = math.pow(n*(n+1)/2,2) return sum_square - square_sum
阅读全文
0 0
- Problem 6 Sum square difference
- 【Project Euler】【Problem 6】Sum square difference
- (Problem 6)Sum square difference
- projecteuler---->problem=6----Sum square difference
- Problem 6 Sum square difference (数学)
- Project Euler Problem 6: Sum square difference
- PE 6 Sum square difference
- 6 Sum square difference - Project Euler
- 欧拉计划(6)Sum square difference
- Project Euler 006 Sum square difference
- 欧拉项目第六题 Sum square difference
- Sum of Square
- Sum of Square
- Sum of Square Numbers
- FOJ Problem 1099 Square
- Sum Problem
- Sum Problem
- sum problem
- 226. Invert Binary Tree
- JAVA 万年历
- X
- 事件处理——仿酷狗音乐和QQ6.0侧滑菜单
- 算法第九节:求最大公约数和最小公倍数
- Problem 6 Sum square difference
- Java 常见小问题源代码 掷骰子 游戏 三个骰子,约定三个骰子的点数1-6
- 剑指offer:第32题从1到n整数中1出现的次数
- java compareTo()
- 【多线程应用2】CreateThread与_beginthreadex本质区别
- 随机生成字母数字的组合
- 函数签名(方法签名)Type signature
- javascript1
- 海思IVE函数使用-1 (DMA使用 HI_MPI_IVE_DMA)