Catalan numbers: Difference between revisions

Content deleted Content added
Line 3,723:
<pre>
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 35357670
</pre>
 
=={{header|Picat}}==
{{works with|Picat}}
<lang Picat>
table
factorial(0) = 1.
 
factorial(N) = N * factorial(N - 1).
 
catalan1(N) = factorial(2 * N) // (factorial(N + 1) * factorial(N)).
 
catalan2(0) = 1.
 
catalan2(N) = 2 * (2 * N - 1) * catalan2(N - 1) // (N + 1).
 
main =>
foreach (I in 0..14)
printf("%d. %d = %d\n", I, catalan1(I), catalan2(I))
end.
</lang>
{{out}}
<pre>
0. 1 = 1
1. 1 = 1
2. 2 = 2
3. 5 = 5
4. 14 = 14
5. 42 = 42
6. 132 = 132
7. 429 = 429
8. 1430 = 1430
9. 4862 = 4862
10. 16796 = 16796
11. 58786 = 58786
12. 208012 = 208012
13. 742900 = 742900
14. 2674440 = 2674440
</pre>