Consider that there is sequence $ a$ of length $ n$ ,$ a=[a_i,0\le i\le n]$ . Now you are given with $ \text{lcm}$ of some pairs of number from list that is, $ \operatorname{lcm}(a_i,a_j)=k$ for $ 0\le i,j\le n$ and $ i\neq j$ and $ k$ is specific for given pair. Find number of sequences of $ a$ that satisfy given $ \text{lcm}$ ‘s.

I thought that if $ \text{lcm}$ pairs are less than number of distinct number of pairs from sequence,than answer if infinity and if there is any contradicting pair then answer is $ 0$ and for remaining case that is where $ \text{lcm}$ involving every element is present then i do not know how to solve. Could anyone help me with this question.