TITLE: What is the number of ordered triplets $(x, y, z)$ such that the LCM of $x, y$ and $z$ is ...
QUESTION [5 upvotes]: What is the number of ordered triplets $(x, y, z)$ such that the LCM of $x, y$ and $z$ is $2^33^3$ where $x, y,z\in \Bbb N$? 

What I tried :
At least one of $x, y$ and $z$ should have factor $2^3$ and at least one should have factor $3^3$. I then tried to figure out the possible combinations but couldn't get the correct answer.

REPLY [2 votes]: Consider all candidate triples of the form:
$$
(2^{a_1}3^{b_1}, 2^{a_2}3^{b_2}, 2^{a_3}3^{b_3})
$$
where for each $i \in \{1, 2, 3\}$, we have $a_i, b_i \in \{0, 1, 2, 3\}$.
We define such a candidate triple to be valid if for some $j, k \in \{1, 2, 3\}$, we have $a_j = 3$ and $b_k = 3$. Otherwise, if ($a_j \in \{0, 1, 2\}$ for all $j \in \{1, 2, 3\}$) or ($b_k \in \{0, 1, 2\}$ for all $k \in \{1, 2, 3\}$), then such a candidate triple is considered invalid.
Observe that:
\begin{align*}
\text{# of valid triples}
&= \text{# of candidate triples} - \text{# of invalid triples} \\
&= 4^6 - (3^3 \cdot 4^3 + 4^3 \cdot 3^3 - 3^6)
\end{align*}