Question: How do I generate the recursion

Please Sir/Ma, I'm trying to generate a recurrent relations of this series and I try to use "if" "else" condition but I didn't get it right. Any one with useful suggestions. Appreciate 

 

restart;
Y[0] := A; Y[1] := B;
if k = a then delta(k-a) := 1 else 0 end if;
                               0
for k from 0 to 10 do Y[k+2] := solve(add(delta(i-1)*(k-i+1)*(k-i+2)*Y[k-i+2], i = 0 .. k)+add((delta(i)-delta(i-1))*(k-i+1)*Y[k-i+1], i = 0 .. k)+lambda*Y[k] = 0, Y[k+2]) end do;
y := sum(Y[j]*x^j, j = 0 .. 10);
 

Please Wait...