Skip to content

Instantly share code, notes, and snippets.

@shieldsd
Created March 30, 2012 14:08
Show Gist options
  • Save shieldsd/2251768 to your computer and use it in GitHub Desktop.
Save shieldsd/2251768 to your computer and use it in GitHub Desktop.
Project Euler #24
from itertools import islice
def comb(l):
if len(l) == 0:
yield []
else:
for i in range(len(l)):
for c in comb(l[:i] + l[i + 1:]):
yield [l[i]] + c
print ''.join(str(i) for i in
islice(comb([0,1,2,3,4,5,6,7,8,9]), 999999, 1000000).next())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment