没错,就是那道黑题。
大量公式刷屏精神污染注意。
题目: 求 $\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c\Big(\dfrac{\operatorname{lcm}(i, j)}{\gcd(i, k)}\Big)^{f(\operatorname{type})}$ 对指定的正整数 $p \in \mathbb{P}$ 取模。其中 $f(\operatorname{type}) = \begin{cases}1 & \operatorname{type} = 0 \\ i \times j \times k & \operatorname{type} = 1 \\ \gcd(i, j, k) & \operatorname{type} = 2\end{cases}$。
完全没有构造原函数的必要,只需要套路式地将出现的 $\gcd$ 转换到 $\mu$ 上即可。
推完这些式子就再也不想做数论题了。老样子图论和树的数据结构还有 dp 一类考验设计思维的题目都比这强。但是,这一套算下来以后就再也不会怕怎么转化 $\gcd$ 了。
从运用上来讲,可能比较让人困惑的点在于 $\displaystyle \sum_{i = 1} ^{a}\sum_{j = 1} ^{b}\sum_{v \mid \gcd(i, j)}\mu(v) = \sum_{v = 1}^{\min(a, b)}\mu(v) \lfloor \frac{a}{v} \rfloor\lfloor \frac{b}{v} \rfloor$ 的转换上。事实上这一步写详细来就能看明白。
$$\sum_{i = 1} ^{a}\sum_{j = 1} ^{b}\sum_{v \mid \gcd(i, j)}\mu(v) = \sum_{i = 1} ^{a}\sum_{j = 1} ^{b}\overbrace{\sum_{\substack{v \mid i \\ v \mid j}}}^{v \mid \gcd(i,j) \iff v\mid i, v\mid j}\mu(v) = \sum_{v = 1} ^{\min(a,b)}\sum_{i = 1} ^{a}[v \mid i]\sum_{j = 1} ^{b}[v \mid j] \mu(v) = \sum_{v = 1}^{\min(a, b)}\mu(v) \lfloor \frac{a}{v} \rfloor\lfloor \frac{b}{v} \rfloor$$
其次就是各种形式的交换次序还有上限的变化。不写清楚同样也很折磨。
其中还用到了欧拉函数和莫比乌斯函数的关系。具体如下。
$$\begin{aligned} &(\mu * 1)(n) = \sum\limits_{v \mid n}\mu(v) 1(\frac{n}{v}) = \sum\limits_{v \mid n}\mu(v) = e(n) \\ &X(n) = n \\ &\varphi(n) = \sum\limits_{v =1}^{n} [\gcd(i, n)=1] = \sum\limits_{v = 1}^n [v \mid n]\mu(v) \sum\limits_{i = 1}^n[v \mid i] = \sum\limits_{v \mid n}^n \mu(v) \lfloor\frac{n}{v} \rfloor = \sum\limits_{v \mid n}^n \mu(v) \frac{n}{v} = \sum\limits_{v \mid n}^n v\mu(\frac{n}{v}) \\ & \boxed{\varphi(n) = (X * \mu)(n)} \Rightarrow n = \sum\limits_{d \mid n}\varphi(d) \end{aligned}$$
上面能拿掉下取整是因为 $v \mid n$。
考虑算术基本定理。此时有 $\begin{cases} i = p_1^{x_1}p_2^{x_2}\cdots p_m^{x_m} \\ \\ j = p_1^{y_1}p_2^{y_2}\cdots p_m^{y_m} \end{cases}$,那么相应地最大公因数要求至少都能取到可以组合成两个数的所有质数,也即 $\gcd(i, j) = p_1^{\min(x_1, y_1)}p_2^{\min(x_2,y_2)}\cdots p_m^{\min(x_m, y_m)}$。
受此启发,不难看到 $\operatorname{lcm}(i, j) = p_1^{\max(x_1, y_1)}p_2^{\max(x_2,y_2)}\cdots p_m^{\max(x_m, y_m)}$。进一步注意到 $ij = \operatorname{lcm}(i, j)\gcd(i,j) = p_1^{x_1 + y_1}p_2^{x_2+y_2}\cdots p_m^{x_m+y_m}$。从而有
$$\begin{aligned}&\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \Big(\dfrac{\operatorname{lcm}(i, j)}{\gcd(i, k)}\Big)^{f(\operatorname{type})} \\=& \displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \Big(\dfrac{i \times j}{\gcd(i, k) \times \gcd(i, j)}\Big)^{f(\operatorname{type})} \\=& \dfrac{\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c (i \times j)^{f(\operatorname{type})}}{\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \Big(\gcd(i, k) \times\gcd(i,j)\Big)^{f(\operatorname{type})}} \\ \\=& \dfrac{\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c i^{f(\operatorname{type})} \times \displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c j^{f(\operatorname{type})}}{\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \gcd(i, j)^{f(\operatorname{type})} \times \displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \gcd(i, k)^{f(\operatorname{type})}} \\=& \dfrac{A_1 \times A_2}{B_1 \times B_2}\end{aligned}$$
类型一
分子部分
$\begin{cases}A_1 = \displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c i = \Big(\displaystyle\prod_{i = 1}i\Big)^{bc} = (a!)^{bc} \\ \\A_2 = (b!)^{ac} \Rightarrow A_1A_2 = (a!)^{bc}(b!)^{ac}\end{cases}$
分母部分
显然依然可以分开考虑。
对于 $B_1$,有 $\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \gcd(i, j) = \Big(\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b \gcd(i, j)\Big)^c$。
考虑先枚举完 $\gcd$ 的值再累乘。在此之前观察累加时的情况以做对比。记 $x = \gcd(i,j)$,那么按照公因子先来枚举就有如下的变形。
$\begin{aligned} \displaystyle \sum_{i = 1}^{a}\sum_{j = 1}^b \gcd(i, j) & = \sum_{x = 1}^{\min(a, b)}x\sum_{i = 1}^{\lfloor\frac{a}{x}\rfloor}\sum_{j = 1}^{\lfloor\frac{b}{x}\rfloor}[\gcd(i, j) = 1] \\& = \sum_{x = 1}^{\min(a, b)}x\sum_{i = 1}^{\lfloor\frac{a}{x}\rfloor}\sum_{j = 1}^{\lfloor\frac{b}{x}\rfloor}\sum_{v \mid \gcd(i, j)}\mu(v) = \sum_{x = 1}^{\min(a, b)}x\sum_{v = 1}^{\min(\lfloor\frac{a}{x}\rfloor, \lfloor\frac{b}{x}\rfloor)}\sum_{i = 1}^{\lfloor\frac{a}{vx}\rfloor}\sum_{j = 1}^{\lfloor\frac{b}{vx}\rfloor} \mu(v) \\&= \sum_{x = 1}^{\min(a, b)}x\sum_{v = 1}^{\min(\lfloor\frac{a}{x}\rfloor, \lfloor\frac{b}{x}\rfloor)} \mu(v) \lfloor\frac{a}{vx}\rfloor\lfloor\frac{b}{vx}\rfloor = \sum_{x = 1}^{\min(a, b)}x \sum_{vx = 1}^{\min(a,b)} \mu(v) \lfloor\frac{a}{vx}\rfloor\lfloor\frac{b}{vx}\rfloor \\&= \sum_{x = 1}^{\min(a, b)}[x | vx]x \sum_{vx = 1}^{\min(a,b)} \mu(\dfrac{vx}{x}) \lfloor\frac{a}{vx}\rfloor\lfloor\frac{b}{vx}\rfloor = \sum_{vx = 1}^{\min(a, b)} \sum_{x | vx}^{\min(a, b)} x\mu(\dfrac{vx}{x}) \lfloor\frac{a}{vx}\rfloor\lfloor\frac{b}{vx}\rfloor\end{aligned}$
观察到 $\displaystyle\sum_{x | vx} x \mu(\dfrac{vx}{x}) = \displaystyle\sum_{x | vx} \displaystyle\sum_{t \mid x}^{\min(a, b)}\varphi(t) \mu(\dfrac{vx}{x}) = \varphi * 1 * \mu = \varphi(vx)$。所以上式还能进一步化简。虽然之后有大用,但下面要用的已经写出来完了。
记 $T = vx$,那么此时有
$$\begin{aligned}\prod_{i = 1} ^a\prod_{j = 1} ^b \gcd(i, j) =&\prod_{x = 1}^{\min(a, b)} {\LARGE x}^ {{\large \sum\limits_{vx = 1}^{\min(a, b)} [x \mid vx]\mu(\frac{vx}{x}) \lfloor\frac{a}{vx}\rfloor\lfloor\frac{b}{vx}\rfloor}} = \prod_{T = 1}^{\min(a, b)}\prod_{x = 1}^{\min(a, b)}[x \mid T] {\LARGE x}^ {{\normalsize \mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{b}{T}\rfloor}} = \prod_{T = 1}^{\min(a, b)}\prod_{x \mid T}^{\min(a, b)} {\LARGE x}^ {{\normalsize \mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{b}{T}\rfloor}} \\ \Rightarrow B_1 = \Big(\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b \gcd(i, j)\Big)^c = & {\huge(}\prod_{T = 1}^{\min(a, b)}\prod_{x \mid T}^{\min(a, b)} {\LARGE x}^ {{\normalsize \mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{b}{T}\rfloor}} {\huge )}^c \\ \Rightarrow B_2 = \Big(\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b \gcd(i, k)\Big)^b= & {\huge(}\prod_{T = 1}^{\min(a, c)}\prod_{x \mid T}^{\min(a, c)} {\LARGE x}^ {{\normalsize \mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{c}{T}\rfloor}} {\huge )}^b\end{aligned}$$
更方便理解的方式是取对数后再算幂次回来。
$\displaystyle \sum_{i = 1} ^a\sum_{j = 1} ^b \ln\gcd(i, j) = \sum_{x = 1}^{\min(a, b)} \ln x\sum_{i = 1}^{\lfloor \frac{a}{x} \rfloor}\sum_{j = 1}^{\lfloor \frac{b}{x} \rfloor}[\gcd(i, j) = 1] = \sum_{x = 1}^{\min(a, b)}\ln x\sum_{v = 1}^{\min(\lfloor \frac{a}{x} \rfloor, \lfloor \frac{b}{x} \rfloor)} \mu(v)\lfloor \frac{a}{vx} \rfloor\lfloor \frac{b}{vx} \rfloor = \sum_{T = 1}^{\min(a, b)}\sum_{x | T}^{\min(a, b)} \ln x\mu(\frac{T}{x})\lfloor \frac{a}{T} \rfloor\lfloor \frac{b}{T} \rfloor$
后面就不放了。
所以现在有第一种情况的答案:
$$\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \dfrac{ i \times j}{\gcd(i, j) \times \gcd(i, k)} = \dfrac{(a!)^{bc}(b!)^{ac}} {\displaystyle {\huge(}\prod_{T = 1}^{\min(a, b)}\prod_{x \mid T}^{\min(a, b)} {\LARGE x}^{{\normalsize\mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{b}{T}\rfloor}} {\huge )}^c {\huge(}\prod_{T = 1}^{\min(a, c)}\prod_{x \mid T}^{\min(a, c)} {\LARGE x}^{{\normalsize\mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{c}{T}\rfloor}} {\huge )}^b}$$
类型二
分子部分
$\begin{cases}A_1 = \displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c i^{ijk} = \displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c (\displaystyle\prod_{i = 1} ^ai^{i})^{jk} = \displaystyle\prod_{i = 1} ^a (i^{i})^{\frac{bc(b+1)(c+1)}{4}} \\A_2 = \displaystyle\prod_{j = 1} ^b (j^{j})^{\frac{ac(a+1)(c+1)}{4}} \Rightarrow A_1A_2 = \displaystyle\prod_{i = 1} ^a (i^{i})^{\frac{bc(b+1)(c+1)}{4}}\displaystyle\prod_{j = 1} ^b (j^{j})^{\frac{ac(a+1)(c+1)}{4}}\end{cases}$
分母部分
$B_1 = \Big(\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b \gcd(i, j)^{ij}\Big)^\frac{c(c + 1)}{2}$。那么考察括号里面的内容就可以得到
$$\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b \gcd(i, j)^{ij} = \prod_{x = 1}^{\min(a, b)} {\LARGE x} ^ {\sum\limits_{i = 1}^{a}\sum\limits_{j = 1}^{b}ij[\gcd(i,j) = x]}$$
由于此处与位置有关,在提出 $x$ 之后需要计算位置的贡献。此处有
不能理解的,建议打表或者拿纸来辅助观察。或者补修求和的知识。
或者果断切成取对数的方式。
$$\begin{aligned}\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b \gcd(i, j)^{ij} &= \prod_{x = 1}^{\min(a, b)} {\LARGE x} ^ {x^2\sum\limits_{i = 1}^{\lfloor \frac{a}{x} \rfloor}\sum\limits_{j = 1}^{\lfloor \frac{d}{x} \rfloor}ij\sum\limits_{v \mid \gcd(i,j)}\mu(v)} \\&= \prod_{x = 1}^{\min(a, b)} {\LARGE x} ^ {x^2\sum\limits_{i = 1}^{\lfloor \frac{a}{x} \rfloor}\sum\limits_{j = 1}^{\lfloor \frac{d}{x} \rfloor}ij\sum\limits_{v = 1}^{\min(\lfloor \frac{a}{x} \rfloor, \lfloor \frac{b}{x} \rfloor)}[v \mid i][v \mid j]\mu(v)} \\ &= \prod_{x = 1}^{\min(a, b)} {\LARGE x} ^ {x^2 \sum\limits_{v = 1}^{\min(\lfloor \frac{a}{x} \rfloor, \lfloor \frac{b}{x} \rfloor)} v^2\mu(v) \sum\limits_{i = 1}^{\lfloor \frac{a}{vx} \rfloor}\sum\limits_{j = 1}^{\lfloor \frac{d}{vx} \rfloor}ij} \\ &= \prod_{x = 1}^{\min(a, b)} {\LARGE x} ^ {x^2 \sum\limits_{v = 1}^{\min(\lfloor \frac{a}{x} \rfloor, \lfloor \frac{b}{x} \rfloor)} v^2\mu(v) \frac{\lfloor \frac{a}{vx} \rfloor\lfloor \frac{b}{vx} \rfloor(\lfloor \frac{a}{vx} \rfloor + 1)(\lfloor \frac{b}{vx} \rfloor + 1)}{2 \times 2}} \\ &= \prod_{x = 1}^{\min(a, b)} {\LARGE x} ^ {x^2 \sum\limits_{T = 1}^{\min(a, b)} [x \mid T]\frac{T^2}{x^2}\mu(\frac{T}{x}) \frac{\lfloor \frac{a}{T} \rfloor\lfloor \frac{b}{T} \rfloor(\lfloor \frac{a}{T} \rfloor + 1)(\lfloor \frac{b}{T} \rfloor + 1)}{2 \times 2}}\\ &= \prod_{T = 1}^{\min(a, b)} {\LARGE x} ^ {\sum\limits_{x \mid T} T^2\mu(\frac{T}{x}) \frac{\lfloor \frac{a}{T} \rfloor\lfloor \frac{b}{T} \rfloor(\lfloor \frac{a}{T} \rfloor + 1)(\lfloor \frac{b}{T} \rfloor + 1)}{2 \times 2}} \\ &= \prod_{T = 1}^{\min(a, b)} {\prod\limits_{x \mid T}\LARGE x} ^ { \mu(\frac{T}{x})T^2 \frac{\lfloor \frac{a}{T} \rfloor\lfloor \frac{b}{T} \rfloor(\lfloor \frac{a}{T} \rfloor + 1)(\lfloor \frac{b}{T} \rfloor + 1)}{2 \times 2}}\end{aligned}$$
另一半同理。换上式中的 $b$ 为 $c$ 即可。
简记从一起求和到第 $n$ 项的高斯求和公式为 $\operatorname{sum}(n) = \dfrac{n(n+1)}{2}$。所以现在有第二种情况的答案:
$$\displaystyle\prod_{i = 1} ^a\prod_{j = 1} ^b\prod_{k = 1} ^c \dfrac{(ij)^{ijk}}{\gcd(i, j)^{ijk} \times \gcd(i, k)^{ijk}} = \dfrac{ \displaystyle\prod_{i = 1} ^a (i^{i})^{\operatorname{sum}(b)\operatorname{sum}(c)}\prod_{j = 1} ^b(j^{j})^{\operatorname{sum}(a)\operatorname{sum}(c)} } { \displaystyle {\huge(} \prod_{T = 1}^{\min(a, b)} {\prod\limits_{x \mid T}\LARGE x} ^ { \mu(\frac{T}{x})T^2\operatorname{sum}(\lfloor \frac{a}{T} \rfloor)\operatorname{sum}(\lfloor \frac{b}{T} \rfloor)} {\huge )}^c \ \times \ {\huge (} \prod_{T = 1}^{\min(a, c)} {\prod\limits_{x \mid T}\LARGE x} ^ { \mu(\frac{T}{x})T^2 \operatorname{sum}(\lfloor \frac{a}{T}\rfloor)\operatorname{sum}(\lfloor \frac{c}{T} \rfloor)} {\huge )}^b }$$
类型三
分子部分
这位更是这位。$A_1 = \displaystyle\prod_{i = 1} ^a\prod_{j = 1} ^b\prod_{k = 1} ^c i^{\gcd(i, j, k)}$ 可以慢慢处理——
$$\begin{aligned}\displaystyle \prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c i^{\gcd(i, j, k)} &= \prod_{j = 1}^{b} \prod_{k = 1}^{c} 1^{\gcd(1, j, k)} \cdot 2^{\gcd(2, j, k)} \cdots a^{\gcd(a, j, k)}\\&= \prod_{i = 1} ^a i^{\sum\limits_{j = 1}^{b}\sum\limits_{k = 1}^{c}\gcd(i, j, k)}\\&=\prod_{i = 1} ^a i^{\sum\limits_{x = 1}^{\min(a, b, c)}x\sum\limits_{j = 1}^{b}\sum\limits_{k = 1}^{c}[\gcd(i, j, k) = x]}\\&=\prod_{i = 1} ^a i^{\sum\limits_{x = 1}^{\min(a, b, c)}x\sum\limits_{j = 1}^{\lfloor \frac{b}{x} \rfloor}\sum\limits_{k = 1}^{\lfloor \frac{c}{x} \rfloor}[\gcd(\frac{i}{x}, j, k) = 1][x \mid i]}\\&=\prod\limits_{x = 1}^{\min(a, b, c)}\prod_{i = 1} ^{\lfloor \frac{a}{x} \rfloor} (ix)^{x\sum\limits_{j = 1}^{\lfloor \frac{b}{x} \rfloor}\sum\limits_{k = 1}^{\lfloor \frac{c}{x} \rfloor}[\gcd(i, j, k) = 1] }\\&=\prod\limits_{x = 1}^{\min(a, b, c)}\prod_{i = 1} ^{\lfloor \frac{a}{x} \rfloor} (ix)^{x\sum\limits_{j = 1}^{\lfloor \frac{b}{x} \rfloor}\sum\limits_{k = 1}^{\lfloor \frac{c}{x} \rfloor}\sum\limits_{\substack{v \mid i , v \mid j\\ v \mid k}}\mu(v)}\\&=\prod\limits_{x = 1}^{\min(a, b, c)}\prod_{i = 1} ^{\lfloor \frac{a}{x} \rfloor} (ix)^{x\sum\limits_{v = 1}^{\min(\lfloor \frac{a}{x} \rfloor, \lfloor \frac{b}{x} \rfloor, \lfloor \frac{c}{x} \rfloor)}\mu(v)[v \mid i] \lfloor \frac{b}{vx} \rfloor \lfloor \frac{c}{vx} \rfloor}\\&=\prod\limits_{x = 1}^{\min(a, b, c)}\prod_{i = 1} ^{\lfloor \frac{a}{x} \rfloor} (ix)^{\sum\limits_{vx = 1}^{\min(a, b, c)}x\mu(\frac{vx}{x})[v \mid i][x \mid vx] \lfloor \frac{b}{vx} \rfloor \lfloor \frac{c}{vx} \rfloor}\\&=\prod\limits_{T = 1}^{\min(a, b, c)}\prod\limits_{x = 1}^{\min(a, b, c)}[x \mid vx]\prod_{i = 1} ^{\lfloor \frac{a}{x} \rfloor}[v \mid i] (ix)^{x\mu(\frac{T}{x}) \lfloor \frac{b}{T} \rfloor \lfloor \frac{c}{T} \rfloor}\\&=\prod\limits_{T = 1}^{\min(a, b, c)}\prod\limits_{x \mid T}^{\min(a, b, c)}\prod_{i = 1} ^{\lfloor \frac{a}{T} \rfloor} (iT)^{\lfloor \frac{b}{T} \rfloor \lfloor \frac{c}{T} \rfloor x\mu(\frac{T}{x}) }\\&=\prod\limits_{T = 1}^{\min(a, b, c)}\prod_{i = 1} ^{\lfloor \frac{a}{T} \rfloor} (iT)^{\lfloor \frac{b}{T} \rfloor \lfloor \frac{c}{T} \rfloor \sum\limits_{x \mid T}^{\min(a, b, c)}x\mu(\frac{T}{x})}\\&=\prod\limits_{T = 1}^{\min(a, b, c)}\prod_{i = 1} ^{\lfloor \frac{a}{T} \rfloor} (iT)^{\varphi(T) \lfloor \frac{b}{T} \rfloor \lfloor \frac{c}{T} \rfloor}\\&=\prod\limits_{T = 1}^{\min(a, b, c)} \Big( (\lfloor \frac{a}{T} \rfloor !)^{\varphi(T) \lfloor \frac{b}{T} \rfloor \lfloor \frac{c}{T} \rfloor } \ \times \ (T)^{\varphi(T) \lfloor \frac{a}{T} \rfloor\lfloor \frac{b}{T} \rfloor \lfloor \frac{c}{T} \rfloor } \Big)\end{aligned}$$
分母部分
整道题最麻烦的部分。
$$\begin{aligned}\displaystyle \prod_{i = 1} ^a\prod_{j = 1} ^b\prod_{k = 1} ^c \gcd(i, j)^{\gcd(i, j, k)} &= \prod_{i = 1} ^a\prod_{j = 1} ^b\gcd(i, j)^{\sum\limits_{k = 1} ^c\gcd(\gcd(i, j), k)}\\&= \prod_{x = 1} ^{\min(a, b)}x^{\sum\limits_{i = 1} ^a\sum\limits_{j = 1} ^b[\gcd(i, j) = x]\sum\limits_{k = 1} ^c\gcd(x, k)}\\&= \prod_{x = 1} ^{\min(a, b)}x^{\sum\limits_{v = 1}^{\min(\lfloor\frac{a}{x} \rfloor, \lfloor\frac{b}{x} \rfloor)}\mu(v) \lfloor\frac{a}{vx} \rfloor\lfloor\frac{b}{vx} \rfloor\sum\limits_{k = 1} ^c\sum\limits_{d \mid \gcd(x, k)} \varphi(d)}\\&= \prod_{x = 1} ^{\min(a, b)}x^{\sum\limits_{vx = 1}^{\min(a, b)}[x \mid vx]\mu(\frac{vx}{x}) \lfloor\frac{a}{vx} \rfloor\lfloor\frac{b}{vx} \rfloor\sum\limits_{k = 1} ^c\sum\limits_{\substack{d \mid x \\ d \mid k}} \varphi(d)}\\&= \prod_{T = 1} ^{\min(a, b)} \prod_{x \mid T}^{\min(a, b)}x^{\mu(\frac{T}{x}) \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor\sum\limits_{d = 1}^{\min(\min(a, b), c)}\varphi(d)[d \mid x]\sum\limits_{k = 1} ^c[d \mid k] }\\&= \prod_{T = 1} ^{\min(a, b)} \prod_{x \mid T}^{\min(a, b)}x^{\mu(\frac{T}{x}) \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor\sum\limits_{d \mid x}^{\min(a, b, c)}\varphi(d)\lfloor\frac{c}{d}\rfloor }\\&= \prod_{T = 1} ^{\min(a, b)} \prod_{x \mid T}^{\min(a, b)} \prod_{d \mid x}^{\min(a, b, c)} x^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor }\\&= \prod_{T = 1} ^{\min(a, b)} \prod_{x \mid T}^{\min(a, b)} \prod_{d \mid x}^{\min(a, b, c)} \Big(\frac{x}{d}\Big)^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor } \ \times \ d^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor }\end{aligned}$$
分别处理两种情况。
情况一:
$$\begin{aligned}\prod_{T = 1} ^{\min(a, b)} \prod_{x \mid T}^{\min(a, b)} \prod_{d \mid x}^{\min(a, b, c)} \Big(\frac{x}{d}\Big)^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor } &=\prod_{T = 1} ^{\min(a, b)} \prod_{x= 1}^{\min(a, b)}[x \mid T]\prod_{d = 1}^{\min(a, b, c)}[d \mid x] \Big(\frac{x}{d}\Big)^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor }\\&=\prod_{d = 1}^{\min(a, b, c)}\prod_{dT = 1} ^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} \prod_{dx= 1}^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)}[dx \mid dT] x^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{dT} \rfloor\lfloor\frac{b}{dT} \rfloor }\\&=\prod_{d = 1}^{\min(a, b, c)}\prod_{dT = 1} ^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} \prod_{x \mid T}^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} x^{\mu(\frac{T}{x}) \lfloor\frac{a}{dT} \rfloor\lfloor\frac{b}{dT} \rfloor \varphi(d)\lfloor\frac{c}{d}\rfloor}\\&=\prod_{d = 1}^{\min(a, b, c)}\prod_{T = 1} ^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} \prod_{x \mid T}^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} x^{\mu(\frac{T}{x}) \lfloor\frac{\lfloor \frac{a}{d} \rfloor}{T} \rfloor\lfloor\frac{\lfloor \frac{b}{d} \rfloor}{T} \rfloor \varphi(d)\lfloor\frac{c}{d}\rfloor}\\&=\prod_{T = 1}^{\min(a, b, c)}\prod_{d = 1} ^{\min(\lfloor\frac{a}{T} \rfloor, \lfloor\frac{b}{T} \rfloor)} \prod_{x \mid d}^{\min(\lfloor\frac{a}{T} \rfloor, \lfloor\frac{b}{T} \rfloor)} x^{\mu(\frac{d}{x}) \lfloor\frac{\lfloor \frac{a}{T} \rfloor}{d} \rfloor\lfloor\frac{\lfloor \frac{b}{T} \rfloor}{d} \rfloor \varphi(T)\lfloor\frac{c}{T}\rfloor}\end{aligned}$$
情况二:
$$\begin{aligned}\prod_{T = 1} ^{\min(a, b)} \prod_{x \mid T}^{\min(a, b)} \prod_{d \mid x}^{\min(a, b, c)} d^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor } &=\prod_{dT = 1} ^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} \prod_{dx = 1}^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)}[x \mid T] \prod_{d = 1}^{\min(a, b, c)} d^{\mu(\frac{dT}{dx}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{dT} \rfloor\lfloor\frac{b}{dT} \rfloor }\\&=\prod_{d = 1}^{\min(a, b, c)}\prod_{dT = 1} ^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} \prod_{dx \mid dT}^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} d^{\mu(\frac{T}{x}) \varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{dT} \rfloor\lfloor\frac{b}{dT} \rfloor }\\&=\prod_{d = 1}^{\min(a, b, c)} d^{\varphi(d)\lfloor\frac{c}{d}\rfloor \sum\limits_{dT = 1} ^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} \lfloor\frac{a}{dT} \rfloor\lfloor\frac{b}{dT} \rfloor \sum\limits_{x \mid T}^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)}\mu(\frac{T}{x}) }\\&=\prod_{d = 1}^{\min(a, b, c)} d^{\varphi(d)\lfloor\frac{c}{d}\rfloor \sum\limits_{dT = 1} ^{\min(\lfloor\frac{a}{d} \rfloor, \lfloor\frac{b}{d} \rfloor)} \lfloor\frac{a}{dT} \rfloor\lfloor\frac{b}{dT} \rfloor e(T)}\\&=\prod_{d = 1}^{\min(a, b, c)} d^{\varphi(d)\lfloor\frac{c}{d}\rfloor \lfloor\frac{a}{d} \rfloor\lfloor\frac{b}{d} \rfloor }=\prod_{T = 1}^{\min(a, b, c)} T^{\varphi(T)\lfloor\frac{c}{T}\rfloor \lfloor\frac{a}{T} \rfloor\lfloor\frac{b}{T} \rfloor }\end{aligned}$$
所以现在有第三种情况的答案:
$$\displaystyle\prod_{i = 1} ^a\prod_{j = 1} ^b\prod_{k = 1} ^c \dfrac{\operatorname{lcm}(i,j)^{\gcd(i, j, k)}}{\gcd(i, k)^{\gcd(i, j, k)}} = \displaystyle\prod_{T = 1}^{\min(a, b, c)}{\Huge(}\dfrac{(\lfloor \frac{a}{T} \rfloor !)^{\lfloor \frac{b}{T} \rfloor \lfloor \frac{c}{T} \rfloor } \ \times \ (\lfloor \frac{b}{T} \rfloor !)^{\lfloor \frac{a}{T} \rfloor \lfloor \frac{c}{T} \rfloor }} { \displaystyle \big( \prod_{d = 1} ^{\min(\lfloor\frac{a}{T} \rfloor, \lfloor\frac{b}{T} \rfloor)} \prod_{x \mid d}^{\min(\lfloor\frac{a}{T} \rfloor, \lfloor\frac{b}{T} \rfloor)} x^{\mu(\frac{d}{x}) \lfloor\frac{\lfloor \frac{a}{T} \rfloor}{d} \rfloor\lfloor\frac{\lfloor \frac{b}{T} \rfloor}{d} \rfloor} \big) ^ {\lfloor\frac{c}{T}\rfloor} \ \times \ \big( \prod_{d = 1} ^{\min(\lfloor\frac{a}{T} \rfloor, \lfloor\frac{c}{T} \rfloor)} \prod_{x \mid d}^{\min(\lfloor\frac{a}{T} \rfloor, \lfloor\frac{c}{T} \rfloor)} x^{\mu(\frac{d}{x}) \lfloor\frac{\lfloor \frac{a}{T} \rfloor}{d} \rfloor\lfloor\frac{\lfloor \frac{c}{T} \rfloor}{d} \rfloor} \big)^{\lfloor\frac{b}{T}\rfloor} } {\Huge)}^{\varphi(T)} = \displaystyle\prod_{T = 1} ^{\min(a, b, c)} \Big( \displaystyle\prod_{i = 1} ^{\lfloor\frac{a}{T}\rfloor}\prod_{j = 1} ^{\lfloor\frac{b}{T}\rfloor}\prod_{k = 1} ^{\lfloor\frac{c}{T}\rfloor} \dfrac{\operatorname{lcm}(i,j)}{\gcd(i, k)}\Big) ^{\varphi(T)}$$
最后有
$$\begin{cases}\displaystyle\prod_{i = 1} ^a\displaystyle\prod_{j = 1} ^b\displaystyle\prod_{k = 1} ^c \dfrac{ i \times j}{\gcd(i, j) \times \gcd(i, k)} = \dfrac{(a!)^{bc}(b!)^{ac}} {\displaystyle {\huge(}\prod_{T = 1}^{\min(a, b)}\prod_{x \mid T}^{\min(a, b)} {\LARGE x}^ {{\normalsize \mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{b}{T}\rfloor}} {\huge )}^c {\huge(}\prod_{T = 1}^{\min(a, c)}\prod_{x \mid T}^{\min(a, c)} {\LARGE x}^ {{\normalsize \mu(\frac{T}{x}) \lfloor\frac{a}{T}\rfloor\lfloor\frac{c}{T}\rfloor}} {\huge )}^b}\\ \displaystyle\prod_{i = 1} ^a\prod_{j = 1} ^b\prod_{k = 1} ^c \dfrac{(ij)^{ijk}}{\gcd(i, j)^{ijk} \times \gcd(i, k)^{ijk}} = \dfrac{ \displaystyle\prod_{i = 1} ^a (i^{i})^{\operatorname{sum}(b)\operatorname{sum}(c)}\prod_{j = 1} ^b (j^{j})^{\operatorname{sum}(a)\operatorname{sum}(c)} } { \displaystyle {\huge(} \prod_{T = 1}^{\min(a, b)} {\prod\limits_{x \mid T}\LARGE x} ^ { \mu(\frac{T}{x})T^2 \operatorname{sum}(\lfloor \frac{a}{T} \rfloor)\operatorname{sum}(\lfloor \frac{b}{T} \rfloor)} {\huge )}^c \ \times \ {\huge (} \prod_{T = 1}^{\min(a, c)} {\prod\limits_{x \mid T}\LARGE x} ^ { \mu(\frac{T}{x})T^2 \operatorname{sum}(\lfloor \frac{a}{T} \rfloor)\operatorname{sum}(\lfloor \frac{c}{T} \rfloor)} {\huge )}^b }\\ \displaystyle\prod_{i = 1} ^a\prod_{j = 1} ^b\prod_{k = 1} ^c \dfrac{\operatorname{lcm}(i,j)^{\gcd(i, j, k)}}{\gcd(i, k)^{\gcd(i, j, k)}} = \displaystyle\prod_{T = 1} ^{\min(a, b, c)} \Big( \displaystyle\prod_{i = 1} ^{\lfloor\frac{a}{T}\rfloor}\prod_{j = 1} ^{\lfloor\frac{b}{T}\rfloor}\prod_{k = 1} ^{\lfloor\frac{c}{T}\rfloor} \dfrac{\operatorname{lcm}(i,j)}{\gcd(i, k)}\Big) ^{\varphi(T)}\end{cases}$$
这题数学上就这样了。代码可以参考洛谷上已有的解答。我就不把我 5.96KB 的放出来了。
前排观看 大佬 膜拜
《 基 础 》