In hcp lattice,
the no. of tetrahedral voids formed is equal to twice the no. of atoms of element which forms the lattice and octahedral void is equal to the number of atoms.
i.e. Tetrahedral voids = 2N (No. of atoms of B)
So the no. of atoms of A present in tetrahedral void = 2/3+1/2 = 7/6
Hence ratio of A:B = 4/3 :1 = 7:6
Hence formula = A7B6
Regards