It's not clear whether you need just a display or formal expression or an actual recursive function. I'll assume the latter.
p[1] = e[1];
p[n_] :=
Simplify[
Sum[e[i]*p[n - i]*(-1)^(1 + i), {i, 1, n - 1}] +
n*e[n]*(-1)^(1 + n)]
This was just a matter of coming up with an expression for p[n]
that matched the pattern provided. I didn't try to simplify it any. The Simplify
just forces the terms to be combined. You should test to verify it actually matches your expectation--it looks correct to me for a small set of terms.
Now, you mentioned subscripts. Subscripts are just notation, so a formal expression like e[4]
can be interpreted as equivalent to a subscripted e
. However, if you really want to see subscripts you can use this:
Format[e[n_]] := Subscript[e, n]
Execute the above before evaluating any specific p
, and then you should see the nicely subscripted format when you do evaluate a specific p
. Understand that this will just affect the display. The actual expressions will still use things like e[5]
.
Since you provided the fully expanded expression on the far right hand side (the ones with just e
and no p
), then I'm assuming that you don't need to keep the intermediate form with p
. If you do need that form, then we'd need to come up with something slightly different.