首先化式子
\[\begin{align} & \prod_{i=1}^{A}\prod_{j=1}^{B}\prod_{k=1}^{C}\left(\frac{\text{lcm}(i,j)}{\gcd(i,k)}\right)^{f(\text{type})} \\ = & \prod_{i=1}^A\prod_{j=1}^B\prod_{k=1}^C \left(\frac{i\times j}{\gcd(i,j)\times\gcd(i,k)}\right)^{f(\text{type})} \\ = & \left(\prod_{i=1}^A\prod_{j=1}^{B}\left(\frac{i\times j}{\gcd(i,j)}\right)^{C\times f(\text{type})}\right)\times\left(\prod_{i=1}^A\prod_{j=1}^C\left(\frac{1}{\gcd(i,j)}\right)^{B\times f(\text{type})}\right) \\ \end{align}\]这样就化为了两个子问题。
\(f(\text{type}) = 1\)
对于前一个式子有:
\[\begin{align} & \prod_{i=1}^A\prod_{j=1}^{B}\left(\frac{i\times j}{\gcd(i,j)}\right)^C \\ =&\prod_{i=1}^A\prod_{j=1}^{B}\prod_{d}[d\mid i][d\mid j] \left(\frac{i\times j}{d}\right)^C \\ =&\prod_{d}\prod_{i=1}^{\lfloor\frac{A}{d}\rfloor}\prod_{j=1}^{\lfloor\frac{B}{d}\rfloor} (i\times j\times d)^C\\ =&\prod_{d}d^C \left(\prod_{i=1}^{\lfloor\frac{A}{d}\rfloor} i^C \right) \left(\prod_{i=1}^{\lfloor\frac{B}{d}\rfloor} i^C \right) \end{align}\]对于后一个式子有:
\[\begin{align} & \prod_{i=1}^A\prod_{j=1}^C\left(\frac{1}{\gcd(i,j)}\right)^{B}\\ =&\prod_{i=1}^A\prod_{j=1}^C\prod_{d}[d\mid i][d\mid j] d^{-B}\\ =&\prod_{d}\prod_{i=1}^{\lfloor\frac{A}{d}\rfloor}\prod_{i=1}{\lfloor\frac{C}{d}\rfloor} d^{-B}\\ =&\prod_{d} \left(\frac{1}{d}\right)^{\lfloor\frac{A}{d}\rfloor\times\lfloor\frac{C}{d}\rfloor\times B} \end{align}\]