Skip to content

Instantly share code, notes, and snippets.

@galenseilis
Created October 15, 2022 23:44
Show Gist options
  • Save galenseilis/14b90e3abcf87e7b83eb5bd1f13c3989 to your computer and use it in GitHub Desktop.
Save galenseilis/14b90e3abcf87e7b83eb5bd1f13c3989 to your computer and use it in GitHub Desktop.
from more_itertools import set_partitions
S = set(range(1,6))
for i in S:
s_i = S - {i}
for left, right in set_partitions(s_i, 2):
if len(left) == len(right) and sum(left) + i == 9 and sum(right) + i == 9:
print(i, left, right)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment