tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,5 @@
function n = catalanNumbers(n)
for i = (1:length(n))
n(i) = (1/(n(i)+1))*nchoosek(2*n(i),n(i));
end
end

View file

@ -0,0 +1,3 @@
function n = catalanNumbers(n)
n = prod(n+1:2*n)/prod(1:n+1);
end

View file

@ -0,0 +1,28 @@
>> catalanNumbers(14)
ans =
2674440
>> catalanNumbers((0:17))'
ans =
1
1
2
5
14
42
132
429
1430
4862
16796
58786
208012
742900
2674440
9694845
35357670
129644790