Created
August 25, 2015 12:15
-
-
Save rtfb/3bf562c6b5ace19e6dfe 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
import itertools | |
def xprf(l): | |
return l[0] + 13*float(l[1])/float(l[2]) + l[3] + 12*l[4] - l[5] - 11 + float(l[6])*float(l[7])/float(l[8]) - 10 | |
def xpri(l): | |
if l[1] % l[2] != 0: | |
return -1 | |
if l[6] % l[8] != 0 and l[7] % l[8] != 0: | |
return -1 | |
return l[0] + 13*l[1]/l[2] + l[3] + 12*l[4] - l[5] - 11 + l[6]*l[7]/l[8] - 10 | |
def solve(): | |
for p in itertools.permutations(range(1, 10)): | |
if xpri(p) == 66: | |
print(p) | |
yield p | |
print(len(list(solve()))) | |
#print(xpri((5, 3, 1, 7, 2, 6, 9, 8, 4))) | |
#print(xprf((8, 5, 2, 7, 4, 9, 1, 3, 6))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment