In this case, since we know the heat of reaction per gram of reactant and we should know the total energy of reaction, but it is not there, we are going to assume it is 1200 J as usual in these problems, so you can change it to whatever your given heat is.
Refer to a modern periodic table for the relative atomic mass of magnesium () and chlorine ():
: .
: .
In other words, the mass of of atoms would be (approximately) .
Likewise, the mass of of atoms would be approximately .
One formula unit of the ionic compound includes exactly as many atoms as there are in the given formula. The formula mass of a compound is the mass of of the formula units of this compound.
The formula includes one atom and two atoms.
Hence, every formula unit of would include the same number of atoms: one atom and two atoms. There would be of atoms and of atoms in of formula units.
Thus, the mass of of formula units would be equal to the mass of of atoms plus the mass of of atoms. (The mass of of each atom could be found from the relative atomic mass of each element.)
.
In other words, the formula mass of is .
Therefore, the number of formula units in of would be:
.
Multiple by Avogadro's Number to estimate the number of formula units in :