Bell numbers: Difference between revisions
Content deleted Content added
m →{{header|Sidef}}: minor simplifications |
m →{{header|F_Sharp|F#}}: Complete required output |
||
Line 37: | Line 37: | ||
===The function=== |
===The function=== |
||
<lang fsharp> |
<lang fsharp> |
||
// Generate bell triangle. Nigel Galloway: |
// Generate bell triangle. Nigel Galloway: July 6th., 2019 |
||
let bell=Seq.unfold(fun g->Some(g,List.scan(+) (List.last g) g))[1I] |
let bell=Seq.unfold(fun g->Some(g,List.scan(+) (List.last g) g))[1I] |
||
</lang> |
</lang> |
||
Line 56: | Line 56: | ||
[4140; 5017; 6097; 7432; 9089; 11155; 13744; 17007; 21147] |
[4140; 5017; 6097; 7432; 9089; 11155; 13744; 17007; 21147] |
||
[21147; 25287; 30304; 36401; 43833; 52922; 64077; 77821; 94828; 115975] |
[21147; 25287; 30304; 36401; 43833; 52922; 64077; 77821; 94828; 115975] |
||
</pre> |
|||
<lang fsharp> |
|||
bell|>Seq.take 15|>Seq.iter(fun n->printf "%A " (List.head n));printfn "" |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
1 1 2 5 15 52 203 877 4140 21147 115975 678570 4213597 27644437 190899322 |
|||
</pre> |
</pre> |
||
<lang fsharp> |
<lang fsharp> |