There's a lot of controversy in writing the first way as I have seen teachers interpret it as Number of Moles = Mass / (Mass x Mass) which basically equate to number of moles being equal to the reciprocal of the mass
Alternatively you can write n = m / M.
There is, however, controversy...