Catalan numbers/Pascal's triangle: Difference between revisions
Content added Content deleted
(→explicit subscripts: {{Out}}) |
PatGarrett (talk | contribs) (Add Scilab section) |
||
Line 593: | Line 593: | ||
<pre> |
<pre> |
||
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 |
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 |
||
</pre> |
|||
=={{header|Scilab}}== |
|||
<lang> |
|||
n=15 |
|||
t=zeros(1,n+2) |
|||
t(1)=1 |
|||
for i=1:n |
|||
for j=i+1:-1:2 |
|||
t(j)=t(j)+t(j-1) |
|||
end |
|||
t(i+1)=t(i) |
|||
for j=i+2:-1:2 |
|||
t(j)=t(j)+t(j-1) |
|||
end |
|||
disp(t(i+1)-t(i)) |
|||
end |
|||
</lang> |
|||
{{out}} |
|||
<pre style="height:20ex"> |
|||
1. |
|||
2. |
|||
5. |
|||
14. |
|||
42. |
|||
132. |
|||
429. |
|||
1430. |
|||
4862. |
|||
16796. |
|||
58786. |
|||
208012. |
|||
742900. |
|||
2674440. |
|||
9694845. |
|||
</pre> |
</pre> |
||