Calculate the formula, and moles If $\ce{1.84\times10^{-4}}$ moles of element A was completely reacted with element B to create $\ce{1.231\times 10^19}$ molecules of $\ce{(A3B2)_x}$ a hypothetical compound, what is the value of x?


I tried this:



$\pu{1 mol} = 6.02 \times 10^{23} ~\pu{molecules}$

$y~\pu{mol} = 1.231 \times 10^{19} ~\pu{molecules}$

$y = \pu{2.0449 \times 10^-5 mol}$



$\ce{(A_3B_2)_x} : 1.84\times10^{-4}+ {2\over 3}(1.84\times10^{-4})=3.067\times10^{-4}$

So it produces $3.067\times10^{-4}$ mol of the compound



and, $3.067 \times 10^{-4}~\pu{mol} \div 2.0449 \times 10^{-5}~\pu{mol} = 15$

And since 1 compound has 5 atoms, $15 \div 5 =3$

Therefore, $x$ is 3



I am not sure if I did this question correctly. Even if I did, is there a more efficient and organized way of solving this problem?
At first you said that $x = \pu{2.0449\times10^−5 mol}$ and then later said $x=3$. It is clearly wrong even without going into the maths!

That said, I believe you are confusing the stoichiometry of the compound with the number of moles of the compound produced. The $x$ in $\ce{(A3B2)_x}$ is a part of the chemical formula for that compound, and not the moles of $\ce{(A3B2)}$ produced.  

For example, $\ce{AlCl3}$ usually exists as a dimer in gas phase, so we write it as $\ce{Al2Cl6}$ or simply $\ce{(AlCl3)2}$ for clarity. You should hence realize that the $x$ in $\ce{(A3B2)_x}$ represents the number of $\ce{A3B2}$ molecules that have polymerized together to form a single molecule. And the question states that $\pu{1.231\times10^19}$ of such molecules was produced. 

With the conceptual clarity attained, we'll now solve the numerical. Note that the question says that all the moles of elemental A were obtained in the compound. This implies:

$$
\begin{align}
\text{moles of A in the compound} &amp;= \text{original moles of elemental A}\\
\implies 3x\times(\text{moles of compound }\ce{A3B2})&amp;=1.84\times10^{-4}
\end{align}
$$

Solving this, you'll get approximately $x=3$, which is the expected answer.