Magic Triangle - Solved
Magic Triangles This puzzle features in CSIRO ’s Double Helix blog post, A Magic Triangle Brainteaser . The Magic Triangle problem involves arranging integers on a triangle. Consider a triangle with a circle at each vertex and along each side: Magic Triangle Arrange the numbers 1 to 6 in the circles so that each side sums to the same value. This specific challenge requires each side to sum to 10. Method for Triangles First, label the nodes sequentially starting from any vertex: Labelled Magic Triangle The solution involves the following steps: Generate all permutations of numbers 1 to 6 as a , b , c , d , e , f . Filter permutations to satisfy the magic shape condition: a + b + c = c + d + e = e + f + a . Apply the final condition: a + b + c = 10 . Using Haskell Generate all permutations of the numbers 1 to 6: import Data.List permutations [ 1 .. 6 ] This yields 6! = 720 permutations. Filter f...