Created
October 4, 2022 09:49
-
-
Save ricardocchaves/a5619e1199ea798fc9b3003c1d157a8d to your computer and use it in GitHub Desktop.
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
#!/bin/python3 | |
# https://www.reddit.com/r/london/comments/xup3yh/monday_maths_at_canada_water_tube_station/ | |
def allUnique(x): | |
seen = set() | |
return not any(i in seen or seen.add(i) for i in str(x)) | |
def allEqual(x): | |
return len(set(str(x))) == 1 | |
ABCDE = 9999 | |
A = 1 | |
EEEEE = 0 | |
while ABCDE < 100000: | |
ABCDE += 1 | |
if not allUnique(ABCDE): | |
continue | |
A = ABCDE//10000 | |
EEEEE = ABCDE * A | |
if allEqual(EEEEE): | |
print("ABCDE:{}\nA:{}\nEEEEE:{}".format(ABCDE,A,EEEEE)) | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment