Given that, atoms of B forms hcp lattice. So, the atoms at corners are shared by 6 unit cells. So, its contribution is 16; Face centered atoms contribute 12 and middle layer atoms contribute 1 each.
So, effective number of atoms in unit cell =16×12+12×2+1×3
=2+1+3=6
Number of tetrahedral voids =2× Number of atoms forming the lattice.
=2×6=12
So, number of atoms of A=23×12=8
Number of atoms of B=6
So, A:B⇒A:B
8:6 4:3
So, formula is A4B3