Most of the methods for selecting the numbers of teeth of planetary mechanisms are based on general equations that take into account three main conditions for their existence: 1) ensuring a given gear ratio, 2) the condition of alignment, 3) the condition of assembly. The rest of the conditions are not included in the system of equations to be solved and are checked additionally. However, this approach has a number of disadvantages associated with the discreteness of the general equations depending on several parameters. Therefore, a method is proposed for selecting the number of teeth using equations obtained only when taking into account two mandatory conditions for the existence of planetary mechanisms: 1) ensuring a given gear ratio, 2) the condition of alignment. Equations for fitting by this method are presented. The remaining conditions for the existence of planetary gears are checked separately and as a result, unsuitable solutions are excluded. This approach ensures the selection of all existing solutions in a given range of teeth numbers with a relatively small number of iterations, but it is rational only when used on a computer. In this regard, the corresponding software has been written - the Planmex.exe program. A description of this program is given, which allows you to select the number of teeth of the wheels of the proposed schemes of planetary gears with a whole and fractional gear ratio, different modules of wheels on a double satellite, a different number of satellites in a given range of numbers of teeth, depending on the selected driving link. Three variants of optimization of the obtained results of selection of the number of teeth are proposed: 1) minimum mass, 2) maximum speed, 3) maximum efficiency. Coefficients are introduced to compare the results within each optimization option and equations are proposed to determine them. An example of the selection of the number of teeth for different modules of gears on a double satellite of the planetary mechanism of the AI scheme by the proposed method using the Planmex.exe program is given. The optimization of the obtained results is made according to three criteria, taking into account the region of existence of the given scheme.