# About showing that the print statement in the pseudocode is executed $C_n$ times

It is an exercise I meet in the book Discrete Mathematics Fifth Edition written by Richard.It is on page 184.It is not my homework!I just learned it by myself but I can't catch up with the solution to this problem.So thanks for helping me !It is something like this:

The pseudocede is like this :(note that "in" is just $i_n$ and n is bigger than 0 I think)

for i1: = 1 to n do
for i2: = 1 to min(i1 ,n-1) do
for i3: = 1 to min(i2,n-2) do
...
for in-1 := 1 to min(in-2,2) do
for in := 1 to 1 do
print i1,i2,i3,...,in


Show that print statement is executed $C_n$ times,where $C_n$ denotes the $n$th Catalan number.

I will appreciate it if you can help me!Thanks!

-
Is this homework? What have you tried? – Matthew Conroy Mar 29 '12 at 4:45
You cannot actually statically nest $n$ for loops where $n$ is variable (the static nesting level of any program is obviously constant). However you can dynamically nest $n$ loop using recursion (do a recursive call from within a loop). Rewriting your program recursively might actually give you a hint for an inductive proof. – Marc van Leeuwen Mar 29 '12 at 12:14