Pascal's triangle: Difference between revisions
Content added Content deleted
(add E example) |
|||
Line 867: | Line 867: | ||
combinations, choose. |
combinations, choose. |
||
Zero maps to the empty list. Negatives are inexpressible. |
Zero maps to the empty list. Negatives are inexpressible. |
||
This solution uses a library routine for binomial coefficients. |
|||
<lang Ursala>#import std |
<lang Ursala>#import std |
||
#import nat |
#import nat |
||
pascal = choose**ziDS+ iota*t+ iota+ successor</lang> |
pascal = choose**ziDS+ iota*t+ iota+ successor</lang> |
||
This solution uses direct summation. |
|||
<lang Ursala> |
|||
#import std |
|||
#import nat |
|||
pascal "n" = ~&tx (rep"n" ^C\~& sum*NhCixp) <<1>> |
|||
</lang> |
|||
test program: |
test program: |
||
<lang Ursala>#cast %nLL |
<lang Ursala>#cast %nLL |
||
Line 887: | Line 895: | ||
<1,8,28,56,70,56,28,8,1>, |
<1,8,28,56,70,56,28,8,1>, |
||
<1,9,36,84,126,126,84,36,9,1>></pre> |
<1,9,36,84,126,126,84,36,9,1>></pre> |
||
=={{header|Vedit macro language}}== |
=={{header|Vedit macro language}}== |