Here’s a Gear Train Calculator that can come up with gear trains of varying complexity to approximate arbitrary ratios from input to output. This is a problem of unbounded difficulty; it is NP-hard. Therefore, this tool is heuristic.

For reasonable inputs, it is practically instantaneous.

Let’s look at an unreasonable example, approximating pi (in particular, the approximation 3.141592653589793; which is the default example) with two stages:

Even four stages calculates almost instantaneously (though slowly enough that I briefly saw an intermediate result flash before being replaced by a final result), and gets twice as many digits of accuracy:

Firefox seems to have decided that it should throttle the script when the tab is in the background, or the screen saver is up, so it’s hard to keep making progress here, but here’s one that’s closer though still 11 decimal digits:

Sometimes if I leave that tab open while doing something else, it makes progress! I now have a solution to my entirely theoretical problem that is within one part in 23.6 trillion, 12 decimal digits…

At first I was surprised it’s taking it that long to calculate this. But then I did the math for your hypothetical 90 options for each gear, and 12 gears to try… 90^12 = 2.82429536481 x 10^23 possible combinations so I guess that makes more sense.

He cuts out a lof of equivalent possibilities rather than the brute-force permutations. I found out about his tool from his replies on a Physics Forums post from someone asking for help computing gear ratios for making an orrery, where he goes into detail on how he constructed his algorithm.

Fortunately the Gear Train Calculator performs the calculation in much less time. It does not try out all permutations in the manner suggested.

By leaving my personal computer on the calculator tab while working on my work computer during the day, this finished, and it never found a better match than it found somewhere in the first 8% of the search space.