code: def mom_recurse(self, idxi, idxj, idxk):
          
          rank_ = min(
              chaospy.bertran.rank(idxi, self.dim),
              chaospy.bertran.rank(idxj, self.dim),
              chaospy.bertran.rank(idxk, self.dim)
          )
          par, axis0 = chaospy.bertran.parent(idxk, self.dim)
          gpar, _ = chaospy.bertran.parent(par, self.dim, axis0)
          idxi_child = chaospy.bertran.child(idxi, self.dim, axis0)
          oneup = chaospy.bertran.child(0, self.dim, axis0)
  
          out1 = self.mom_111(idxi_child, idxj, par)
          out2 = self.mom_111(
              chaospy.bertran.child(oneup, self.dim, axis0), par, par)
          for k in range(gpar, idxk):
              if chaospy.bertran.rank(k, self.dim) >= rank_:
                  out1 -= self.mom_111(oneup, k, par) \
                      * self.mom_111(idxi, idxj, k)
                  out2 -= self.mom_111(oneup, par, k) \
                      * self(oneup, k, par)
          return out1 / out2
docs: Backend mement main loop.