Check on Theorem 27.7 of page 313  (Memoir-Jan-05)   for n = 2

The version number of Mathematica used to evaluate this notebook:

$VersionNumber

p  =  10;    Date[]

TrueQ[ $VersionNumber >= 3.0]

$VersionNumber

a[2][z_]:=b[2][z]-D[b[1][z], z]/2-(b[1][z])^2/4

w[0, 0][z_]=1;

w[0, 1][z_]=Binomial[m, 2]*b[1][z];

w[0, 2][z_]=( Binomial[m + 1, 3]*a[2][z]+((m - 1)/2)*D[w[0, 1][z], z]+((m - 1)/(2 m))*(w[0, 1][z])^2 );

w[j_,i_][z_]:=w[i, j][z] /; j > i

Do[ SumOfPowers[n,j_]=Sum[k^n,{k, j + 1, m}],{n,  0,  2*p + 1}]

K[-1,j_]=0;

K[0,j_]=1;

summandK[i_,j_]:=Expand[ 
            D[K[i, j], z] - ((m - 1)*b[1][z]*K[i, j])/2 + 
              (m - i - j + 1)*(1 - i - j)*a[2][z]*K[i - 1, j]]

Do[ K[i,j_]=Module[{t, k},t = Expand[summandK[i - 1, k]];Sum[Coefficient[t, k, n]*SumOfPowers[n, j],{n, 0, 2*i - 1}]],{i, 1, p}]

L[i1_,i2_]:=Sum[K[i1 - r1, r1]*K[i2 - r2, r2]*w[r1, r2][z],{r1,0,i1},{r2,0,i2}]

H[l1_, l2_, h1_, h2_] := 
      Binomial[m - h1, l1 - h1]*Product[(l1 - r), {r, 1, l1 - h1}]*
        Binomial[m - h2, l2 - h2]*Product[ (l2 - r), {r, 1, l2 - h2}]

M[l1_,l2_,h1_,i_]:=Evaluate[(H[l1, l2, h1, h2]*L[h1, h2] /. h2 -> i - h1)]

U[-1,j_]=0;

U[0,j_]=1;

summandForU[i_,j_]:=Expand[
            D[U[i, j], z] + (i + j - m)*b[1][z]*U[i, j] + 
              (m - i - j + 1)*(1 - i - j)*b[2][z]*U[i - 1, j]]

Do[U[i,j_]=Module[{u, r},
u = Expand[summandForU[i - 1, r]];Sum[Coefficient[u, r, n]*SumOfPowers[n, j],{n, 0, 2*i - 1}]],{i, 1, p}]

V[i1_,i2_]:=Sum[ U[i1 - r1, r1]*U[i2 - r2, r2]*w[r1, r2][z],{r1,0,i1},{r2,0,i2}]

W[l1_,l2_,h1_,i_]:=Evaluate[(H[l1, l2, h1, h2]*V[h1, h2] /. h2 -> i - h1)]

A[l1_,l2_,i_]:=-1/(l1 + l2 + i - 1)

B[l1_,l2_,i_]:=(l1 + l2 - i)/(l1 + l2 + i - 2)

difference[l1_,l2_]:=Module[{t, u},Do[t[h1, 0] =  0,{h1, 0, l1}];Do[t[h1, 1] = 0,{h1, 0, l1} ];Do[ t[h1, i] = 
                      M[l1, l2, h1, i] + 
                        A[l1, l2, i - 1]*D[ t[h1, i - 1], z] + 
                        B[l1, l2, i - 1]*a[2][z]*t[h1, i - 2], {i, 2, l1 + l2}, {h1, 0, l1}];Inv[l1, l2]=Sum[t[h1, l1 + l2],{h1, 0, l1}];Do[u[h1, 0] = 0,{h1, 0, l1}];Do[ u[h1, 1] = 0,{h1, 0, l1}];Do[u[h1, i] = 
                      W[l1, l2, h1, i] + 
                        A[l1, l2, i - 1]*
                          (D[u[h1, i - 1], z] + 
                              (i - 1)*b[1][z]*u[h1, i - 1]) + 
                        B[l1, l2, i - 1]*b[2][z]*u[h1, i - 2],{i, 2, l1 + l2},{h1, 0, l1}];J[l1, l2]=Sum[ u[h1, l1 + l2],{h1, 0, l1}];Print["The number of terms in Inv[", l1, ", ", l2, 
                  "] is ", Length[Expand[Inv[l1, l2]]]];Print["The number of terms in J[", l1, ", ", l2, 
                  "] is ", Length[Expand[J[l1, l2]]]];Print["The memory currently used (in bytes) is ", 
                  MemoryInUse[]];Print["Inv[", l1, ", ", l2, "] - J[", l1, 
                  ", ", l2, "] = ", Expand[Inv[l1, l2] -  J[l1, l2]]]
                  ;Print["The maximum memory used (in bytes) is ", 
                  MaxMemoryUsed[]];Print[Date[]];Print["     "];Clear[t, u, Inv, J]]

Do[difference[0, l2],{l2,3,p}]

Do[ difference[l1, l2], {l1, 1, p}, {l2, l1, p - l1}]