Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
22
Task/Catalan-numbers/FunL/catalan-numbers.funl
Normal file
22
Task/Catalan-numbers/FunL/catalan-numbers.funl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import integers.choose
|
||||
import util.TextTable
|
||||
|
||||
def
|
||||
catalan( n ) = choose( 2n, n )/(n + 1)
|
||||
|
||||
catalan2( n ) = product( (n + k)/k | k <- 2..n )
|
||||
|
||||
catalan3( 0 ) = 1
|
||||
catalan3( n ) = 2*(2n - 1)/(n + 1)*catalan3( n - 1 )
|
||||
|
||||
t = TextTable()
|
||||
t.header( 'n', 'definition', 'product', 'recursive' )
|
||||
t.line()
|
||||
|
||||
for i <- 1..4
|
||||
t.rightAlignment( i )
|
||||
|
||||
for i <- 0..15
|
||||
t.row( i, catalan(i), catalan2(i), catalan3(i) )
|
||||
|
||||
println( t )
|
||||
Loading…
Add table
Add a link
Reference in a new issue