Created
December 17, 2020 00:33
-
-
Save V0XNIHILI/b370978c62ee5306f351a6a64a3e5f00 to your computer and use it in GitHub Desktop.
On 16-12-20, Maarten sent me as message asking whether I knew what was special about today's date. I didn't know, but it turned out that 12^2+16^2=20^2. So I made a little Python program to check this for all years from 2000-3000:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for y in range(0, 1000): | |
for m in range(1,13): | |
max_day = 32 | |
# Month length correction | |
if m == 11 or m == 9 or m == 6 or m == 4: | |
max_day = 31 | |
# Leap year correction | |
elif m == 2: | |
y_actual = y + 2000 | |
max_day = 29 | |
if (y_actual % 4) == 0: | |
if (y_actual % 100) == 0: | |
if (y_actual % 400) == 0: | |
max_day = 30 | |
else: | |
max_day = 30 | |
for d in range(1,max_day): | |
if y ** 2 + m ** 2 == d ** 2: | |
print("y**2 + m**2 = d**2, for: " + str(d) + "-" + str(m) + "-" + str(y+2000)) | |
if d ** 2 + m ** 2 == y ** 2: | |
print("d**2 + m**2 = y**2, for: " + str(d) + "-" + str(m) + "-" + str(y+2000)) | |
if y ** 2 + d ** 2 == m ** 2: | |
print("y**2 + d**2 = m**2, for: " + str(d) + "-" + str(m) + "-" + str(y+2000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment