Is “amount of substance” the same thing as “number of moles”?
"Amount of substance" is one of the seven base quantities of the SI [1]. Its dimension is noted with the symbol N, and its base unit is the mole (mol). Similarly "length" is another base quantity with dimension noted L and with base unit the meter (m).

"Number of moles of [substance X]" rigorously means the numerical value (thus dimensionless) associated with the corresponding "amount of [substance X]" expressed in moles, but from my experience it is often misused for "amount of [substance X]" (thus of the dimension of an "amount of substance"). - Think about how you would respond to the question: "How many meters are there between your house and the nearest bakery?" You could answer "35" or "35 meters", both would be grammatically correct; but strictly speaking the question expects just a numerical answer.  

Note that according to the SI, a number of entities (molecules, atoms,..) is dimensionless and the unit of a dimensionless quantity is simply the number one, 1 [1]. My way of reconciling these two views (an "amount of substance" of dimension N and of unit the mole vs. a number of entities, dimensionless and of unit 1) is that the "amount of substance" refers to a combination of an amount (a number) and a given type of entity of a given substance, whereas a number of entity simply refers to the number itself. Why not consider an amount of substance as a dimensionless quantity? I think it is a reminiscence of history, at the time when chemists had to measure amount of substance without knowing how this substance was structured (but I can be wrong).

Regarding the equations, I agree with this other answer by @desc (equation 1 is correct, equation 2 isn't). Importantly: "atomic weight" is dimensionless (it is a ratio between a mass and a reference mass) and should not to be mistaken with "atomic mass". [2]

Finally, regarding the units "gram-atom" or "gram-molecule", these are outdated units which, according to SI were connected with "atomic weights" and "molecular weights" [2]:


  Following the discovery of the fundamental laws of chemistry, units
  called, for example, "gram-atom" and "gram-molecule", were used to
  specify amounts of chemical elements or compounds. These units had a
  direct connection with "atomic weights" and "molecular weights", which
  are in fact relative masses. "Atomic weights" were originally referred
  to the atomic weight of oxygen, by general agreement taken as 16. But
  whereas physicists separated the isotopes in a mass spectrometer and
  attributed the value 16 to one of the isotopes of oxygen, chemists
  attributed the same value to the (slightly variable) mixture of
  isotopes 16, 17 and 18, which was for them the naturally occurring
  element oxygen. Finally an agreement between the International Union
  of Pure and Applied Physics (IUPAP) and the International Union of
  Pure and Applied Chemistry (IUPAC) brought this duality to an end in
  1959/60. Physicists and chemists have ever since agreed to assign the
  value 12, exactly, to the so-called atomic weight of the isotope of
  carbon with mass number 12 (carbon 12, $^{12}$C), correctly called the
  relative atomic mass $A_r$($^{12}$C). The unified scale thus obtained gives
  the relative atomic and molecular masses, also known as the atomic and
  molecular weights, respectively.
  [2]



https://www.bipm.org/en/publications/si-brochure/chapter1.html
https://www.bipm.org/en/publications/si-brochure/mole.html