Why is the following code wrong? binomial coefficient
<p>I am doing project euler and i am at problem 15 now, here is a link: 
<a href="https://projecteuler.net/problem=15" rel="nofollow">https://projecteuler.net/problem=15</a> . I am trying to solve this with binomial coefficient. Here is a site that explains it: <a href="http://www.mathblog.dk/project-euler-15/" rel="nofollow">http://www.mathblog.dk/project-euler-15/</a> . You can find it at the bottom.</p>

<p>My question is, why is the following code wrong? Since this follows the mathematical algorithm I think: n-k+i/i</p>

<pre><code>        int grid = 20;
        long paths = 1;
        for (int i = 0; i &lt; grid; i++)
        {
            paths *= (grid * 2) - (grid + i)
            paths /= (i + 1);
        }
        Console.WriteLine(paths);
        Console.ReadKey();
</code></pre>

<p>And why is this code wrong? This is exactly as the mathblog site but in 1 line.</p>

<pre><code>        int grid = 20;
        long paths = 1;
        for (int i = 0; i &lt; grid; i++)
        {
            paths *= ((grid * 2) - i) / (i + 1);
        }
        Console.WriteLine(paths);
        Console.ReadKey();
</code></pre>

<p>But why is this code right then? Isnt it the same as the previous code? And it doesn't exactly follow the mathematical algorithm does it? Because it's n-k+i/i, and this code does n-i/i</p>

<pre><code>       int grid = 20;
        long paths = 1;
        for (int i = 0; i &lt; grid; i++)
        {
            paths *= ((grid * 2) - i);
            paths /=  (i + 1);
        }
        Console.WriteLine(paths);
        Console.ReadKey();
</code></pre>

<p>Thnx guys!</p>