Last active
September 12, 2021 07:26
-
-
Save neizod/458644902edbe6f7cacdb970c7e472c7 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
#!/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