Skip to content

Instantly share code, notes, and snippets.

@nathanleclaire
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanleclaire/0ea0672dee3b2458c2ad to your computer and use it in GitHub Desktop.
Save nathanleclaire/0ea0672dee3b2458c2ad to your computer and use it in GitHub Desktop.
print all numbers < 1 million that have digits which sum to 42
print len([n for n in range(0, 1000000) if sum(int(i) for i in str(n)) == 42])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment