Evaluate binomial coefficients: Difference between revisions
Content added Content deleted
Line 2,528: | Line 2,528: | ||
{{works with|Smalltalk/X}} |
{{works with|Smalltalk/X}} |
||
Having a small language but a big class library in my bag, we can write: |
Having a small language but a big class library in my bag, we can write: |
||
<lang smalltalk>Transcript showCR: ( |
<lang smalltalk>Transcript showCR: (5 binco:3). |
||
(Transcript showCR: (400 binco:200)</lang> |
|||
{{out}} |
{{out}} |
||
<pre>10 |
|||
102952500135414432972975880320401986757210925381077648234849059575923332372651958598336595518976492951564048597506774120 |
102952500135414432972975880320401986757210925381077648234849059575923332372651958598336595518976492951564048597506774120</pre> |
||
A naïve implementation (in the Integer class) might look like: |
|||
<lang smalltalk>binco:arg |
|||
^ (self factorial) / (arg factorial * (self-arg) factorial)</lang> |
|||
=={{header|Stata}}== |
=={{header|Stata}}== |