- Number of atoms of B in hcp lattice per unit cell = 6.
- Number of octahedral voids per atom = 1.
- Number of tetrahedral voids per atom = 2.
Atoms of A occupy:
\[
\frac{1}{3} \times 6 = 2 \quad \text{octahedral voids}
\]
\[
\frac{1}{3} \times (2 \times 6) = 4 \quad \text{tetrahedral voids}
\]
Total atoms of A = \(2 + 4 = 6\). So ratio of A to B is \(6:6 = 1:1\).
Hence, molecular formula is \(\mathrm{AB}\).