For $n \ge 2$ there isn't just one identity; there are actually $n+1$ identities, half of which are dual to the other half, and two of which are the trivial identity $a_1 ... a_n = a_1 ... a_n$. The first two are as follows. Let $P = a_1 ... a_n$. Then
$\displaystyle a_1 ... a_n = \text{gcd}(a_1, a_2, ... a_n) \text{lcm} \left( \frac{P}{a_1}, \frac{P}{a_2}, ... \right).$
$\displaystyle a_1 ... a_n = \text{gcd}(a_1 a_2, a_1 a_3, ..., a_{n-1} a_n) \text{lcm} \left( \frac{P}{a_1 a_2}, \frac{P}{a_1 a_3}, ..., \frac{P}{a_{n-1} a_n} \right).$
The other identities are similar. This is because "pointwise" (e.g. at a particular prime $p$) the two-variable identity is just the identity $\text{min}(a, b) + \text{max}(a, b) = a + b$ for non-negative integers $a, b$, and the above identities are the natural generalization of this one.