5. Lucia wants to write three positive integers $a, b, c$ such that each of them is a divisor of $30$ and that the greatest common divisors between two consecutive terms (i.e., $\operatorname{MCD}(a, b)$ and $\operatorname{MCD}(b, c)$) are prime numbers. In how many ways can she do this?
(A) 69
(B) 72
(C) 105
(D) $2^{7}$
(E) None of the above.
5. The answer is (C). Let's distinguish several cases, depending on the number of prime factors of $b$:

(a) if $b$ has 0 prime factors, then $b=1$, and regardless of the value of $a$, we have $(a, b)=1$, which is not a prime number.

(b) if $b$ has exactly one prime factor, i.e., it is itself a prime number, then the condition that $(a, b)$ and $(b, c)$ are primes means that both must coincide with $b$. The integers $a, c$ can therefore be chosen in any way among the divisors of $30=2 \cdot 3 \cdot 5$ that are multiples of $b$. It is easy to verify that (regardless of the value of $b$) there are 4 choices for $a$ and 4 choices for $c$ (for example, if $b=2$, then $a$ and $c$ can be chosen from the set $\{2,6,10,30\}$). Considering that $30=2 \cdot 3 \cdot 5$ has exactly 3 distinct prime factors (and thus there are 3 choices for $b$ in this case), we have $3 \cdot 4 \cdot 4=48$ possible choices for the triplet $(a, b, c)$.

(c) if $b$ has exactly 2 prime factors, say $b=p q$, then setting $r=30 / b$ it is easily seen that the condition that $(a, b)$ and $(a, c)$ are prime numbers is equivalent to the fact that the integers $a, c$ belong to the set $\{p, q, p r, q r\}$. Note that choosing $b$ is equivalent to choosing the prime $r \in\{2,3,5\}$, so in this case we have 3 choices for $b$ and 4 choices for each of $a$ and $c$, for a total of $3 \cdot 4 \cdot 4=48$ possible choices.

(d) finally, if $b$ has exactly 3 prime factors, then we have $b=30$. Since by hypothesis $a$ and $c$ divide 30, we have $(a, b)=a$ and $(b, c)=c$, so we must choose both $a$ and $c$ from the set $\{2,3,5\}$. We then have $3 \cdot 3=9$ choices for the triplet $(a, b, c)=(a, 30, c)$.

In total, the number of triplets $(a, b, c)$ that satisfy the desired properties is $48+48+9=105$.