Why bother going through the math? There is a simple way to get chain length, start by putting your gearing in "small small" and look to see if the derailleur cage is backing into the actual derailleur becuase of the spring, I usually start by removing two links. your derailleurs cage should be more or less parallel to the floor, well so the cage does not back up into the derailleur.