Combinatorics Coincidence
Combinatorics for Fun
At my current workplace, there are several engineers who have an affinity for combinatorics. As a result, discussions about combinatorics problems often occur at the cafeteria. Probability theory is another popular topic of discussion. Of course, often combinatorics and probability theory go hand in hand.
Recurrence Relation
At the cafeteria one day, I joined in on a conversation about combinatorics problems. During the conversation, I happened to share the following problem:
For integers
Nested Loops
Soon after I shared the above problem, a colleague of mine shared this problem with me:
Consider the following pseudocode with k
nested
loops:
x = 0
for c1 in 0 to (n - 1):
for c2 in 0 to (c1 - 1):
...
for ck in 0 to (ck-1 - 1):
x = x + 1
What is the final value of x
after the outermost loop
terminates?
Coincidence
With one problem each, we went back to our desks. As I began solving the nested loops problem shared by my colleague, I realised that the solution to his problem led me to the recurrence relation in the problem I shared with him.
In the nested loops problem, if
If
Extending this argument, we now see that for any
Closed-Form Expression
The closed form expression for the recurrence relation is
In the nested loops problem, the following inequalities are
always met due to the loop conditions:
Let us consider
The above argument holds good because the number of balls on the
right side of the first stick does not exceed
The number of permutations of