Files
aocpy/2015/d4.py
2024-10-20 15:19:25 -04:00

16 lines
348 B
Python

from lib import get_data
import hashlib
data = get_data(__file__).strip()
for digits in [5, 6]:
for i in range(10**9):
text = data + str(i)
md5_hash = hashlib.md5(text.encode()).hexdigest()
for c in md5_hash[:digits]:
if c != "0":
break
else:
print(i)
break