The complexity of the formula seems to match the complexity of the problem: three lists of decreasing integers matching the three groups, multiplied/divided as appropriate.
The hard bit is having the intuition to see that this is right, which is just what Bill Dubuque's answer goes on about in the linked article.
The hard bit is having the intuition to see that this is right, which is just what Bill Dubuque's answer goes on about in the linked article.