Skip to content

Instantly share code, notes, and snippets.

@cdsmith
Last active May 15, 2019 01:10
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 cdsmith/7eebc4c41d7a1e92bf78a8c5380417a0 to your computer and use it in GitHub Desktop.
Save cdsmith/7eebc4c41d7a1e92bf78a8c5380417a0 to your computer and use it in GitHub Desktop.
> [ (a, b, c, d, e, f, g, h) | [a, b, c, d, e, f, g, h] <- permutations [1..8], 10*a+b == 10*c+d + 10*e+f + 10*g+h]
[]
> [ (a, b, c, d, e, f, g, h) | [a, b, c, d, e, f, g, h] <- permutations [1..8], 10*a+b > 10*c+d + 10*e+f + 10*g+h, c > e, e > g]
[(8,4,3,5,2,6,1,7),
(8,5,3,4,2,6,1,7),
(8,6,3,4,2,5,1,7),
(8,6,4,3,2,5,1,7),
(8,4,3,6,2,5,1,7),
(8,6,4,5,2,3,1,7),
(8,5,3,6,2,4,1,7),
(8,6,3,5,2,4,1,7),
(8,7,3,4,2,5,1,6),
(7,8,3,4,2,5,1,6),
(8,7,4,3,2,5,1,6),
(8,4,3,7,2,5,1,6),
(8,4,3,5,2,7,1,6),
(8,7,4,5,2,3,1,6),
(8,5,3,7,2,4,1,6),
(8,5,3,4,2,7,1,6),
(8,7,3,5,2,4,1,6),
(7,8,3,5,2,4,1,6),
(8,6,4,7,2,5,1,3),
(8,6,4,5,2,7,1,3),
(8,7,4,6,2,5,1,3),
(8,7,4,5,2,6,1,3),
(8,6,3,7,2,4,1,5),
(8,6,3,4,2,7,1,5),
(8,7,3,6,2,4,1,5),
(7,8,3,6,2,4,1,5),
(8,7,3,4,2,6,1,5),
(7,8,3,4,2,6,1,5),
(8,6,4,7,2,3,1,5),
(8,6,4,3,2,7,1,5),
(8,7,4,6,2,3,1,5),
(8,7,4,3,2,6,1,5),
(8,4,3,7,2,6,1,5),
(8,4,3,6,2,7,1,5),
(8,6,3,7,2,5,1,4),
(8,6,3,5,2,7,1,4),
(8,7,3,6,2,5,1,4),
(7,8,3,6,2,5,1,4),
(8,7,3,5,2,6,1,4),
(7,8,3,5,2,6,1,4),
(8,5,3,7,2,6,1,4),
(8,5,3,6,2,7,1,4)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment