The problem being that each of these parameters rely on the other to be calculated before it can be satisfied.
The solution is simple. Use the equation for each of the parameters within the calculation for the other parameters.
We do need to use some preferences within the calculations, for instance you may have a particular preference for your pitch. Or it may be a preferred distance for the pattern to start.
These preferences may be variable, in which case you can use an IF statement to select a value of a number of possible options.
This example requires you to enter your preffered pitch (but it could just as easily be calculated in the rules), DriveWorksXpress calculates the Top Distance and quantity based on this entry.