Catalan numbers/Pascal's triangle: Difference between revisions

Added XPL0 example.
(added Arturo)
(Added XPL0 example.)
Line 2,280:
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845
</pre>
=={{header|XPL0}}==
{{trans|C++}}
<syntaxhighlight lang "XPL0">def N = 15;
int T(N+2), I, J;
[T(0):= 0; T(1):= 1;
for I:= 1 to N do
[for J:= I downto 2 do T(J):= T(J) + T(J-1);
T(I+1):= T(I);
for J:= I+1 downto 2 do T(J):= T(J) + T(J-1);
IntOut(0, T(I+1) - T(I)); ChOut(0, ^ );
];
]</syntaxhighlight>
{{out}}
<pre>
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 </pre>
=={{header|Zig}}==
Uses comptime functionality to compile Pascal's triangle into the object code, then at runtime, it's simply a table lookup. (uses code from AKS primality task.)
297

edits