This seems like more of a brute force method @ByteInBits @Astralica What I thought is that for the current possibilites, 2 is the highest common factor for a! and b!, so you can factorise out 4: 4(…) If 3 is a common factor, then you can factor out 9, making it impossible for any other triples.