what is the general form of $T(n)=nT(n-1)+1$

60 Views Asked by At

$T(n)=nT(n-1)+1$ where $T(0)=0$ there is hints $nCr ~ nPr ~T(n-1) = (n-1) T(n-2) + 1 n * ((n-1) * T(n-2) + 1) + 1 n * (n-1) * T(n-2) + n + 1 T(n) = n * (n-1) * (n-2) * ... * 1 * T(0) + n * (n-1) * (n-2) * ... * 1 + 1 n(n-1)(n-2)T(n-3)+n(n-1)+n+1$

1

There are 1 best solutions below

2
On

Divide the recurrence relation by $n!$ to get $$\frac{T(n)}{n!}=\frac{T(n-1)}{(n-1)!}+\frac{1}{n!}$$ Unfolding the recurrence we have $$\frac{T(n)}{n!} = \sum_{k=1}^n \frac{1}{k!}$$

so $$T(n)=n!\sum_{k=1}^n\frac{1}{k!}$$

and since there's no closed formula for that sum, that is the simplest form you're going to get for $T(n)$.