Graham's law of diffusion
$$\frac{r_A}{r_B} =\frac{1}{4}\implies\sqrt{\frac{M_B}{M_A}}=\frac{1}{4}$$
$$\therefore \frac{M_B}{M_A} = \frac{1}{16}$$
On dividing the given mass by molar mass, we get the respective number of moles.
Let the number of moles be denoted by $n$
$$\therefore {n_A} = \frac{m_{A}}{M_{A}}$$
$$\therefore {n_B} = \frac{m_{B}}{M_{B}}$$
$$\therefore \frac{n_{A}}{n_B} = \frac{m_{A}\cdot M_{B}}{M_{A}\cdot m_{B}} = \frac{m_{A}}{m_{B}} \cdot \frac{M_{B}}{M_{A}} = \frac{1}{24}$$

I do not see what's wrong.
Do you want the mole fractions of A and B?