Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Statistics
- 프로그래머스
- programmers
- Laminar
- Turbulent
- regression
- Python
- Heat Equation
- 예제
- heap
- 힙
- 우선순위큐
- Fluid Dynamics
- Blasius
- python3
- Finite Difference Method
- 유체역학
- FTCS
- 회귀
- projecteuler
- Compressible Flow
- 파이썬
- Crank-Nicolson
- Navier-Stokes
- 프로젝트오일러
- Boundary Layers
- Fluids
- 이중우선순위큐
- 통계학
- 디스크 컨트롤러
Archives
- Today
- Total
Sudal's Garage
Project Euler 6 본문
Question:
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385The square of the sum of the first ten natural numbers is,(1 + 2 + ... + 10)2 = 552 = 3025Hence 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부터 10까지 자연수를 각각 제곱해 더하면 다음과 같습니다 (제곱의 합).
12 + 22 + ... + 102 = 385
1부터 10을 먼저 더한 다음에 그 결과를 제곱하면 다음과 같습니다 (합의 제곱).
(1 + 2 + ... + 10)2 = 552 = 3025
따라서 1부터 10까지 자연수에 대해 "합의 제곱"과 "제곱의 합" 의 차이는 3025 - 385 = 2640 이 됩니다.
그러면 1부터 100까지 자연수에 대해 "합의 제곱"과 "제곱의 합"의 차이는 얼마입니까?
Solution:
1 | print(pow(sum(range(101)),2) - sum(x ** 2 for x in range(101))) | cs |
간단한 수학문제 2.
"제곱의 합" 에서 Comprehension을 또 써봤다
'Programming > Project Euler - python' 카테고리의 다른 글
Project Euler 9 (0) | 2019.02.06 |
---|---|
Project Euler 8 (0) | 2019.02.05 |
Project Euler 5 (0) | 2019.01.30 |
Project Euler 4 (0) | 2019.01.30 |
Project Euler 3 (0) | 2019.01.30 |