Last active
November 25, 2023 17:23
-
-
Save wsdookadr/1044fa93fb3188d03630f06ab2d8cd34 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/python3 | |
# mawk's problem statement: | |
# the original question is: how many 6-sided (numbered from 1 to 6) fair dice are needed so that you can form 936 different products of the results? | |
# with 2 dice you can form the products 1·1, 1·2, …, 6·6 | |
# the issue of course here is that 4 = 2² and 6 = 2·3 | |
# if the dice were numbered with 1 2 3 5 7 11 it would be much easier | |
S=set([]) | |
D=156 | |
for d in range(D+1): | |
if len(S) == 0: | |
S|=set(range(1,7)) | |
else: | |
S2=[] | |
for v1 in range(1,7): | |
for v2 in S: | |
S2.append(v1*v2) | |
S|=set(S2) | |
print("d=",d,"|S|=",len(S)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment