Last active
December 16, 2015 03:59
-
-
Save Gnitset/5373368 to your computer and use it in GitHub Desktop.
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
def is_sorted(a): | |
for (c,d) in enumerate(a): | |
if c!=d: | |
return False | |
return True | |
def shuffle(a): | |
a_len=len(a) | |
map(a.extend,zip(a[:a_len/2],a[a_len/2:a_len])) | |
del a[:a_len] | |
def try_deck(size): | |
a=range(size) | |
shuffle(a) | |
i=1 | |
while not is_sorted(a): | |
shuffle(a) | |
i+=1 | |
return i | |
for Z in range(2,1025,2): | |
print Z,try_deck(Z) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment