I did it a little different, starting with the premise that I didn't assume my speedo was perfect to start with. Just applying a formula won't fix a speedo error (and US vehicle speedos are often WAY off out of the factory - I think they can be something like 5% off legally).
Anyway, after converting to 31" tires, I went out and did a speedo check run, recording the actual speed (using a GPS) at 10mph increments from 30 to 80 (oops, I must have meant 60, since those last two readings would have required speeding).
Then I counted the teeth on my current speedo drive gear.
Then I figured the ratio between my actual speed and indicated speed for each of the readings I took, and used the average.
Then I divided the counted number of teeth on my current gear by the average ratio, and rounded up or down to the nearest whole number.
It came out really close to a whole number (27 teeth, if I recall correctly). My problem was that the gear was only available in a long-shaft version (for the early 90's cable-drive speedo), so I had to order one of those and melt / glue the 27 tooth gear onto my short shaft.
The results were great - my speedo is off no more than about 1mph at any speed (kinda nice when I pass those "Your Speed Is" signs, they agree with my dash).