I encountered this solution to the problem in the title (calculate Pascal's Triangle $N$-th row). The main point is the calculation within the loop - I am trying to figure out the meaning of it:
For every $0\leqslant i\leqslant n$: $$\alpha_0 = 1,\quad \alpha_i = \dfrac{\alpha_{i-1}(a+i-1)}{i}.$$
Why is it correct? I assume its related to the binomial coefficients in a way. Thanks!
I suspect your formula there is related to alisianoi's solution to this SO question on efficient binomial computation. Note in the code comments, you have the following:
$$\frac{n!}{k!(n - k)!} = \frac{n(n - 1)\dots(n - k + 1)}{k(k-1)\dots(1)} = \prod_{i = 1}^{k}\frac{n + 1 - i}{i}$$
$C_n^k = C_n^{n - k},$
$\min(k, n - k).$