The sum of the squares of the first ten natural numbers is,
1
2 + 2 2 + ... + 10 2 = 385The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)
2 = 55 2 = 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.
처음부터 10개의 자연수의 제곱의 합은
1
2 + 2 2 + ... + 10 2 = 385 이다.처음부터 10개의 자연수의 합의 제곱은
(1 + 2 + ... + 10)
2 = 55 2 = 3025 이다.그래서 두 수의 차이는 3025
385 = 2640 이다.
처음부터 100개의 자연수의 제곱의 합과 합의 제곱의 차이를 찾아라.

처음부터 100개의 자연수의 제곱의 합과 합의 제곱의 차이를 찾아라.
수학 시간에 합의 공식을 배웠다면 굳이 코딩을 하지 않더라도 계산으로 풀 수가 있다. 하지만 이번 것에서는 계산이 더 귀찮으니 코딩을 하자 :)
Python
참고 사항 :
No Code
댓글 없음:
댓글 쓰기