title: Integer square root function in Haskell
body: <p>The integer square root of a positive integer n is the largest integer whose square is
  less than or equal to n. (E.g. the integer square root of 7 is 2, and that of 9 is 3).</p>
  
  <p>Here is my attempt:</p>
  
  <pre><code>intSquareRoot :: Int -&gt; Int
  intSquareRoot n
      | n*n &gt; n   = intSquareRoot (n - 1) 
      | n*n &lt;= n  = n
  </code></pre>
  
  <p>I'm guessing its not working because n decreases along with the recursion as required, but due to this being Haskell you can't use variables to keep the original n.</p>