CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 18:16:42 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=9b95d30003adb14e5b7d6a730abdb3468ac3fe64b0791c0472911bd39c59d906a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22Beto0jlnLeLKLjZYuFDnYrGCX-Cydltn%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d059a2184edfa6-BLR
Project Euler, Problem #6, Python - Pastebin.com
SHARE
TWEET

Project Euler, Problem #6, Python
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Find the difference between the sum of the squares of the first one
- # hundred natural numbers and the square of the sum.
- # Solution #1
- natNumSum = 0
- the_range = range(1, 101)
- for i in the_range:
- natNumSum += i
- natNumSquareSum = 0
- for i in the_range:
- natNumSquareSum += i ** 2
- print(natNumSum ** 2 - natNumSquareSum)
- # 25164150
- # 4 function calls in 0.000 seconds
- # Solution #2
- the_range = range(1, 101)
- natural_numbers_sum_square = sum(the_range) ** 2
- natural_numbers_squares_sum = sum([i ** 2 for i in the_range])
- print(natural_numbers_sum_square - natural_numbers_squares_sum)
- # 25164150
- # 7 function calls in 0.000 seconds
- # Solution #3
- the_range = range(1, 101)
- natural_numbers_sum_square = sum(the_range) ** 2
- natural_numbers_squares_sum = sum(map((lambda x: x ** 2), the_range))
- print(natural_numbers_sum_square - natural_numbers_squares_sum)
- # 25164150
- # 106 function calls in 0.000 seconds
Add Comment
Please, Sign In to add comment
-
⭐✅ Trading Profit Method ✅ NEVER SEEN BEFORE...
JavaScript | 1 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ J
JavaScript | 8 sec ago | 0.24 KB
-
⭐⭐⭐Crypto Accounts⭐⭐
Java | 10 sec ago | 0.10 KB
-
⭐ Instant BTC Profit Method ✅ NEVER SEEN BEFO...
JavaScript | 11 sec ago | 0.24 KB
-
⭐✅ Swapzone Glitch ✅ Working⭐⭐⭐ D
JavaScript | 17 sec ago | 0.24 KB
-
⭐✅ MAKE $2000 INSTANTLY ✅ NEVER SEEN BEFORE ⭐...
JavaScript | 20 sec ago | 0.24 KB
-
⭐⭐⭐Crypto Accounts⭐⭐
Java | 21 sec ago | 0.10 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 3
JavaScript | 26 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand