If any of the input files contains more than one permutation, only the first one is read. The orbits are calculated by a recursive technique. The first permutation is used to remember which points have already been output, by making the point number negative. A stack is kept of those points that have been found in the orbit but have not yet been multiplied by the generators. The point is put onto the stack, and operation then continues by taking a point off the stack, and for each generator in turn, if its image is new, putting it on the stack and marking it as done.
Points are output as they are multiplied by the generators.
By default, ZMO starts with point 1. A different starting point may be selected with the -s option. The program produces two files of output. Orbits is a permutation-format list of all the points in the first orbit, followed by all the points in the second etc. This permutation p can be used to conjugate the permutations input to ZMO such that the orbits of the resulting permutations are contiguous.