tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
23
Task/Catalan-numbers/Factor/catalan-numbers.factor
Normal file
23
Task/Catalan-numbers/Factor/catalan-numbers.factor
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
: next ( seq -- newseq )
|
||||
[ ] [ last ] [ length ] tri
|
||||
[ 2 * 1 - 2 * ] [ 1 + ] bi /
|
||||
* suffix ;
|
||||
: Catalan ( n -- seq ) V{ 1 } swap 1 - [ next ] times ;
|
||||
15 Catalan .
|
||||
V{
|
||||
1
|
||||
1
|
||||
2
|
||||
5
|
||||
14
|
||||
42
|
||||
132
|
||||
429
|
||||
1430
|
||||
4862
|
||||
16796
|
||||
58786
|
||||
208012
|
||||
742900
|
||||
2674440
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue