<i>&gt; why must r be an integer?</i><p><i>r</i> is a shorthand for <i>(m-n^2)q-2np</i>, which is an integer because <i>m,n,p,q</i> are all integers.<p><i>&gt; There seems to be an implicit assumption that m is an integer, but the explicit assumptions only give the much weaker statement that &quot;m is not a perfect square&quot;.</i><p>Yes, it would have been more explicit to say &quot;m is an integer that is not a perfect square.&quot;<p>On the other hand, this is pretty clear from the context. This is like looking at a computer program and saying &quot;foo has no side-effect&quot; without stating that &quot;foo is a function&quot;.