Skip to content

Instantly share code, notes, and snippets.

@devth
Created July 1, 2013 22:29
Show Gist options
  • Save devth/5905199 to your computer and use it in GitHub Desktop.
Save devth/5905199 to your computer and use it in GitHub Desktop.
-- find the elements of two 3-element sets whose cartesian products, when multiplied
-- form a 5-element set
setMembers = head [[a, b, c, d, e, f] | a <- [1..10], b <- [2..14], c <- [4..20], d <- [6..24],
e <- [7..25], f <- [6..30],
length [a, b, c, d, e, f] == length (nub [a, b, c, d, e, f]),
length (nub [x*y | x <- [a, b, c], y <- [d, e, f]]) == 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment