Evaluate binomial coefficients: Difference between revisions

Line 2,528:
{{works with|Smalltalk/X}}
Having a small language but a big class library in my bag, we can write:
<lang smalltalk>Transcript showCR: (4005 binomialCoefficientbinco:2003)</lang>.
(Transcript showCR: (400 binco:200)</lang>
{{out}}
<pre>10
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}}==
Anonymous user