Converting a function with single parameter to a function with multiple parameters
You could do it by making the second parameter of your function function like the index of the summation, and recursively increment this parameter as long as $0 \leq i &lt; n$.

$$f(n, i) = \begin{cases}
    1 &amp; \text{if } n =0\\
    f(i, 0)\cdot f(n-i-1,0) + f(n, i+1) &amp; \text{if } 0 \leq i &lt; n\\
    0 &amp; \text{otherwise}\\
\end{cases}$$

Then $f(n, 0)$ gives you the answer you want.