Using RSolve correctly
The incomplete Euler gamma function is defined with :
$$\Gamma(a,z)=\int_{z}^{\infty} t^{a-1} e^{-t} d t$$
You can observe that the integral is defined for Re[a] > 0
:
Integrate[t^(a - 1) Exp[-t], {t, 0, Infinity}]
ConditionalExpression[ Gamma[a], Re[a] > 0]
while for a == 0
this does not converge.
Starting with your recurrence relation one easily finds : $q(1)=1,\; q(2)=2,\; q(3) = 5,\; q(4)=16$.
Taking the initial condition $q(1)=1\;$ instead of $q(0)=0\;$ we find :
RSolve[{ q[n] == 1 + (n - 1) q[n - 1], q[1] == 1}, q[n], n]
{{q[n] -> E Gamma[n, 1]}}
This is correct since we can simplfy it with FullSimplify
, even though one cannot simplify the original result E Gamma[n, 1]
directly for all natural numbers.
FullSimplify[ Table[E Gamma[n, 1], {n, 8}], n ∈ Range[8]]
{1, 2, 5, 16, 65, 326, 1957, 13700}
Ad addendum
Another recurrence relation is clearly not equivalent to the original one. That relation binds values for equal k
and i
only, not for all natural i
and k
like you seem to expect. RSolve
perhaps will be updated with more options in the future but they should be appropriate to satisfy only perfectly well posed conditions.
You can see that your original initial condition (for i == 0
) has been inappropriate to satisfy the final result in terms of the Euler gamma function.
Your sequence is
q[0] = 0;
q[i_] := 1 + (i - 1) q[i - 1]
And I used the following code to find some terms for the above sequence.
For[ k = 1, k < 12, k++, Print[ q [ k ] ] ]
And the output is
1 2 5 16 65 326 1957 13700 109601 986410 9864101
These numbers are "Total number of arrangements of a set with n elements". You can find them here.