Rick, I was curious about the question you posed at the beginning of the article. I think the general problem is way too hard for me, but I can try to make some progress by working on r=1E6. The algorithm can be reversed by using the inverse of L1, L2 & L3, and it is possible to map out, for every triple, the length of the path going back up the tree to (3, 4, 5). Doing this for all 159,169 triples, I can show the depth vs the cumulative percentage of triples the algorithm finds: . Depth % 15 61.68 20 76.51 30 87.65 40 92.03 60 95.60 80 97.04 120 98.35 200 99.22 300 99.60 500 99.87 705 100.00 . I found it surprising that such a large depth is necessary, and in fact the final level returns just a single triple, the one with the smallest angle. You can verify this with the code: . x = {3 4 5} * ( L1**705 ); . which gives the triple (1413, 998284, 998285). Not often that you get to take the 705th power of a matrix!