Remix.run Logo
lispitillo 6 days ago

If you want a one line code, in J, for the 42 solutions:

   _ 11 11 #:,I. 0=,a+/,+/~  a=: 2 4 1 3 8 7 _3 _1 12 _5 _8
Or the 8 solutions in a 2x12 matrix:

   2 12 $, ~. (/:~)"1 ({&a)  _ 11 11 #:,I. 0=,a+/,+/~  a=: 2   4 1 3 8 7 _3 _1 12 _5 _8

   _3 1 2 _5  2 3 _1 _1 2 _8  4 4
   _5 1 4 _3 _1 4 _8  1 7 _5 _3 8