The number of ATP molecules required is calculated by dividing the total energy needed by the energy released per ATP molecule.