Last active
January 8, 2020 11:51
-
-
Save LukasForst/a410afed8e04383ac5294d17bf3ac497 to your computer and use it in GitHub Desktop.
Find all three digit numbers that does not contain 0, sum is 1617 and their product ends with 40. Also, no number can repeat and one number must be even and other one odd.
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 i in range(912, 987): | |
for j in range(612, 698): | |
# contains zero | |
if((str(i) + str(j)).count('0')): | |
continue | |
# one must be even and one odd | |
if((i + j) % 2 == 0): | |
continue | |
# all numbers must be unique | |
if(len(set(str(i) + str(j))) != 6): | |
continue | |
# final condition | |
if(i + j == 1617 and (i * j) % 100 == 40): | |
print(f'{i} - {j}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment