Skip to content

Instantly share code, notes, and snippets.

@SamP20
Created January 6, 2016 09:11
Show Gist options
  • Save SamP20/79f7e91ebadce071c836 to your computer and use it in GitHub Desktop.
Save SamP20/79f7e91ebadce071c836 to your computer and use it in GitHub Desktop.
Self descripting number solver
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