If you add a column of 1's on the left (and a column of sums of 1 .. N after the 1..N column), you get Pascal's triangle, and thus the link to combinatorics:
1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 1 3 6 10 15 21 28 36 45 55 1 4 10 20 35 56 84 120 165 220 1 5 15 35 70 126 210 330 495 715 1 6 21 56 126 252 462 792 1287 2002 1 7 28 84 210 462 924 1716 3003 5005 1 8 36 120 330 792 1716 3432 6435 11440
Update: added missing 3rd column as per eric256's observation
Fcn(D,N) => (5,10) seems to correspond to Choose(16,7) where Choose(n,k) is n!/k!(n-k)!
Likewise, Fcn(5,20) seems to correspond to Choose(26,7).
More generically, it looks like your function can be reduced to Choose(D+N+1,D+2)
Of course, you still have recursion in the computation of the factorial, so I don't think you can quite avoid it entirely.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In reply to Re^2: Math fun.
by xdg
in thread Math fun.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |