Skip to content

Instantly share code, notes, and snippets.

@jakobkogler
Created February 24, 2016 10:10
Show Gist options
  • Save jakobkogler/fb276d0a2bb51cd84fc3 to your computer and use it in GitHub Desktop.
Save jakobkogler/fb276d0a2bb51cd84fc3 to your computer and use it in GitHub Desktop.
Valid move sequences on one axis on a 13x13x13 cube
from itertools import product
disallow = 0
for move in product([0, 1, 2, 3], repeat=13):
A, B, C, D = [move.count(i) for i in range(4)]
if max(A, B, C) > D:
disallow += 1
total = 4**13 - 1 # empty sequence
print('keep {} / {} move sequences'.format(total - disallow, total))
# output:
# keep 21281715 / 67108863 move sequences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment