I am doing problem 68 at project euler and came up with the following code in Haskell to return the list of numbers which fit the (given) solution:
lists = [n|n<- permutations [1..6] , ring n ]
ring [a,b,c,d,e,f] = (length $ nub $ map sum [[d,c,b],[f,b,a],[e,a,c]]) == 1
This only returns a list of lists of 6 numbers each which fit the solution. What I don t know how to do, is make it return the actual solution, the lists that fit the form:
[d,c,b],[f,b,a],[e,a,c]
How can I make lists
return a list of this format?
(PS: I will add in the appropriate functions to return what the site actually wants later)