"So we have P1..." etc should be N(P1) i.e, the number of P1's terms.
The sequel should be adjusted mutatis mutandis.
You may edit, if you are so inclined.
blackjack
flooble's webmaster puzzle