Jump to content

Evaluate binomial coefficients: Difference between revisions

(Nimrod -> Nim)
Line 1,030:
<lang OCaml>open Num;;
let rec binomial n k = if n = k then Int 1 else ((binomial (n-1) k) */ Int n) // Int (n-k)</lang>
 
 
=={{header|Oforth}}==
 
<lang Oforth>func: binomial(n, k) { | i | 1 k loop: i [ n i - 1 + * i / ] }</lang>
 
{{out}}
<pre>
>binomial(5, 3) println
10
</pre>
 
=={{header|Oz}}==
1,015

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.