3 ms·
That script (with the -1 at the end replaced with the correct -10) does not work, at least on Python2. It misses the solution (1, 8, 3, 7, 4, 5, 2, 6, 9). Here
by tzs 12y ago
That script (with the -1 at the end replaced with the correct -10) does not work, at least on Python2. It misses the solution (1, 8, 3, 7, 4, 5, 2, 6, 9).
Here's a fixed script:
from itertools import permutations
def f(a, b, c, d, e, f, g, h, i):
return a + (13 * b * i + g * h * c) / (i * c) + d + 12 * e - f - 11 - 10
solutions = [p for p in permutations(range(1, 10)) if f(*p) == 66]
print(len(solutions))
- deleted 12y ago[deleted]