I have a problem that I'm working on. I have an arbitrary number of pins in a straight line. I need to place a gear on each pin such that the first gear drives the last gear. The last gear must go at double the speed of the first gear. In other words, the last gear must be half the size of the first gear (I think).
It's simple to figure this out by brute force for integers. For instance, if you have a pin at point 4, 30 and 50, the first gear would be 12, the second 14 and the last 6.
This becomes much more complex in the case where the gear size is a fraction. I'm trying to figure out some formula or algorithm which I can use figure it out.
Also, it's not always possible to have a solution. For instance, 4, 17, 50 has no solution.