CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 20:55:44 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=f51336d3c7e792efcce6723654dc88ca199b1b05336637bcd1969505d2e6679fa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22Cqp0LqauMkM6QzKYtwPZorrUzqIb-DSm%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d14291bf07dfa6-BLR
Project Euler, Problem #8, Python - Pastebin.com
SHARE
TWEET

Project Euler, Problem #8, Python
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python3
- # The four adjacent digits in the 1000-digit number
- # 731671765313306249192251196744265747423553491949349698352031277450632623957831
- # 801698480186947885184385861560789112949495459501737958331952853208805511125406
- # 987471585238630507156932909632952274430435576689664895044524452316173185640309
- # 871112172238311362229893423380308135336276614282806444486645238749303589072962
- # 904915604407723907138105158593079608667017242712188399879790879227492190169972
- # 088809377665727333001053367881220235421809751254540594752243525849077116705560
- # 136048395864467063244157221553975369781797784617406495514929086256932197846862
- # 248283972241375657056057490261407972968652414535100474821663704844031998900088
- # 952434506585412275886668811642717147992444292823086346567481391912316282458617
- # 866458359124566529476545682848912883142607690042242190226710556263211111093705
- # 442175069416589604080719840385096245544436298123098787992724428490918884580156
- # 166097919133875499200524063689912560717606058861164671094050775410022569831552
- # 0005593572972571636269561882670428252483600823257530420752963450
- # that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find the
- # thirteen adjacent digits in the 1000-digitnumber that have the
- # greatest product. What is the value of this product?
- # The input value shouldn't be formatted like this, but if it's not split into
- # lines, Pastebin aparently deems the code dangerous.
- a = 73167176531330624919225119674426574742355349194934969835203127745
- 063262395783180169848018694788518438586156078911294949545950173795833
- 195285320880551112540698747158523863050715693290963295227443043557668
- 966489504452445231617318564030987111217223831136222989342338030813533
- 627661428280644448664523874930358907296290491560440772390713810515859
- 307960866701724271218839987979087922749219016997208880937766572733300
- 105336788122023542180975125454059475224352584907711670556013604839586
- 446706324415722155397536978179778461740649551492908625693219784686224
- 828397224137565705605749026140797296865241453510047482166370484403199
- 890008895243450658541227588666881164271714799244429282308634656748139
- 191231628245861786645835912456652947654568284891288314260769004224219
- 022671055626321111109370544217506941658960408071984038509624554443629
- 812309878799272442849091888458015616609791913387549920052406368991256
- 071760605886116467109405077541002256983155200055935729725716362695618
- 82670428252483600823257530420752963450
- h = e = g = 1
- f = i = 0
- for b in range(999, 11, -1):
- c = a
- for d in range(b, b - 13, -1):
- e = c // 10 ** d
- f += e * 10 ** (12 - (b - d))
- g *= e
- c -= e * 10 ** d
- if g > h:
- h = g
- i = f
- j = a // 10 ** b
- a -= j * 10 ** b
- g = 1
- f = 0
- print("The sequence is ", i, ", its product is ", h, sep="")
- # The sequence is 5576689664895, its product is 23514624000
- # 4 function calls in 0.168 seconds
Advertisement
Add Comment
Please, Sign In to add comment
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 4
JavaScript | 1 sec ago | 0.25 KB
-
📌 ChangeNOW Exploit
JavaScript | 6 sec ago | 0.24 KB
-
📌 Swapzone +37% glitch ⭐ V
JavaScript | 10 sec ago | 0.25 KB
-
📌 Instant BTC Profit Method ✅ Working
JavaScript | 16 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ O
JavaScript | 19 sec ago | 0.25 KB
-
📝 MAKE $2500 IN 15 MIN ✅ Working
JavaScript | 25 sec ago | 0.24 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 29 sec ago | 0.25 KB
-
💵 Make 3000$ in 20 minutes 💵
JavaScript | 34 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