Lah numbers: Difference between revisions

Realize in F#
(Moved Vala to the right place)
(Realize in F#)
Line 670:
12 0 479001600 2634508800 4390848000 3293136000 1317254400 307359360 43908480 3920400 217800 7260 132 1</pre>
 
=={{header|F_Sharp|F#}}==
<syntaxhighlight lang="fsharp">
// Lah numbers. Nigel Galloway: January 3rd., 2023
let fact(n:int)=let rec fact=function n when n=0I->1I |n->n*fact(n-1I) in fact(bigint n)
let rec lah=function (_,0)|(0,_)->0I |(n,1)->fact n |(n,g) when n=g->1I |(n,g)->((fact n)*(fact(n-1)))/((fact g)*(fact(g-1)))/(fact(n-g))
for n in {0..12} do (for g in {0..n} do printf $"%A{lah(n,g)} "); printfn ""
printfn $"\n\n%A{seq{for n in 1..99->lah(100,n)}|>Seq.max}"
</syntaxhighlight>
{{out}}
<pre>
0
0 1
0 2 1
0 6 6 1
0 24 36 12 1
0 120 240 120 20 1
0 720 1800 1200 300 30 1
0 5040 15120 12600 4200 630 42 1
0 40320 141120 141120 58800 11760 1176 56 1
0 362880 1451520 1693440 846720 211680 28224 2016 72 1
0 3628800 16329600 21772800 12700800 3810240 635040 60480 3240 90 1
0 39916800 199584000 299376000 199584000 69854400 13970880 1663200 118800 4950 110 1
0 479001600 2634508800 4390848000 3293136000 1317254400 307359360 43908480 3920400 217800 7260 132 1
 
 
44519005448993144810881324947684737529186447692709328597242209638906324913313742508392928375354932241404408343800007105650554669129521241784320000000000000000000000
</pre>
=={{header|Factor}}==
{{works with|Factor|0.99 development version 2019-07-10}}
2,172

edits