Skip to content

Instantly share code, notes, and snippets.

@neizod
Last active September 12, 2021 07:26
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 neizod/458644902edbe6f7cacdb970c7e472c7 to your computer and use it in GitHub Desktop.
Save neizod/458644902edbe6f7cacdb970c7e472c7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from itertools import combinations
def is_undividable_clique(family, number):
for subgraph in combinations(family, 4):
if sum(subgraph) % number == 0:
return False
return True
number = 23
natural_number_set = range(1, number)
for size in range(4, number+1):
print('now checking', size)
for family in combinations(natural_number_set, size):
if is_undividable_clique(family, number):
break
else:
break
size -= 1
print(size)
families = []
ways = 0
for family in combinations(natural_number_set, size):
if is_undividable_clique(family, number):
ways += 1
families += [family]
print(ways)
print(families[0])
print(families[-1])
print(max(families, key=sum))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment