Consider the algorithm below
Precondition: n is a non-negative integer
function f ( n )
{
temp = 0
if (n != 0)
{
for (i = 1; i <= 3; i++)
temp = temp + n * f(n-1)
return temp
}
else
return 1;
Solve for the closed form by repeated substitution