Background:
Amount of substance is a fundamental physical quantity which has mole (mol) as it's SI unit. Therefore all expressions for amount of substance should have the unit mole on simplification.
If $A$ is the amount of substance (normally in moles), $m$ is the mass of the substance in a particular unit (normally in grams), $M$ is the mass per unit amount of substance (normally in grams/mole), then \begin{align} A &= \frac{m}{M}\tag1\label1 \end{align}
If the substance is a molecule then $M$ is known as molar mass of the substance.
But in my textbook and in many websites on the internet, I have encountered the phrase number of moles. I think it refers to the amount of substance or maybe the numerical part in the amount of substance. The formulas given there were strange.
If $n$ is the number of moles, $m$ is the mass of the substance in grams and $x$ is the atomic weight (for atoms of elements) or molecular weight (for molecules of elements and compounds), then,
\begin{align} n &= \frac{m}{x}\tag2\label2 \end{align}
This equation is not dimensionally correct if I am right.
My questions:
First of all I would like to ask whether amount of substance and number of moles refer to the same thing, or is it that amount of substance has a unit along with a numerical value whereas number of moles does not have a unit and represents the numerical value in the magnitude of the amount of substance.
Secondly, between equations $\eqref1$ and $\eqref2$, which one is completely correct (both in meaning and dimension)?
Thirdly, since in some place I have encountered gram atomic/molecular mass in place of molar mass, I would like to know what are the differences between both and do they have the same units or different units?