The optimum distribution will occur when the comma is equally distributed over all those factors in the longest line, with zero errors for those in the shortest line. Now to obtain the error in any interval just prime factorise the interval's ratio and sum the errors for each prime on the top line and subtract the errors for each prime on the bottom line. Now lets look at what happens if we are willing to temper the octave. With the 2's left in, the longest line is the bottom one, with 5 factors. But remember I said that this is a simplified version of the procedure that doesn't work for ratios with more than one tempered prime factor on either side.
Lets look at the errors.
Because some errors cancelled out between the two sides of the ratio. This is one of the other cases I didn't go into above. So the real proviso is, it works for ratios where the counts, of tempered prime factors on each side of the ratio, differ by at most one. So now we go back to the syntonic comma ratio and count prime factors top and bottom using this weighting. So there's no point in tempering the octaves for meantone if we are only concerned about the seven ratios whose errors are listed above.