Atoms of element B form HCP lattice and those of element A occupy two thirds of tetrahedral voids. The formula of the compound is
The number of tetrahedral voids formed is equal to twice the number of atoms of element B. But only 2/3 of these tetrahedral voids are occupied by atoms of element A.
Therefore the ratio of number of atoms of A and B is
2x(2/3) : 1 = 4:3
The formula of compound is A4B3