Created
January 6, 2016 09:11
-
-
Save SamP20/79f7e91ebadce071c836 to your computer and use it in GitHub Desktop.
Self descripting number solver
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
if __name__ == '__main__': | |
try: | |
for i in range(10000000000): | |
tmp = i | |
counts = [0,0,0,0,0,0,0,0,0,0] | |
numbers = [] | |
for x in range(10): | |
n = tmp % 10 | |
numbers.append(n) | |
counts[n] += 1 | |
tmp = tmp//10 | |
found = True | |
for x in range(10): | |
if numbers[9-x] != counts[x]: | |
found = False | |
break; | |
if found: | |
print(i) | |
except KeyboardInterrupt: | |
print("got to %i" % i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment