Catalan numbers: Difference between revisions
Content added Content deleted
(Added Fōrmulæ solution) |
|||
Line 1,798: | Line 1,798: | ||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |
||
<lang fsharp> |
|||
<p>In the REPL (with 3rd equation):</p> |
|||
Seq.unfold(fun (c,n) -> let cc = 2*(2*n-1)*c/(n+1) in Some(c,(cc,n+1))) (1,1) |> Seq.take 15 |> Seq.iter (printf "%i, ") |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, val it : unit = () |
1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, val it : unit = () |
||
</pre> |
</pre> |