|
MATHEMATICA
|
ab[n_, m_, q_]:=Sum[q[n-m-r, k], {r, 1, m}, {k, m+1-r, n-m-r}]
bb[n_, m_, q_]:=Sum[q[n-m-r, m-r], {r, 1, m-1}]+Sum[q[n-m-r, k], {r, 1, m-1}, {k, m-r, n-m-r}]
cb[n_, m_, q_]:=Sum[q[n-m-r, m-1-r], {r, 1, m-2}]
a[n_, m_]:=0/; n<=1||m<=0
a[n_, m_]:=a[n, m]=Sum[(k-m)p[n-m, k], {k, m+1, n-m}]+ab[n, m, b]+2ab[n, m, c]+Sum[(r-1)c[n-m-r, m+1-r], {r, 2, m}]
b[1, 1]=1;
b[n_, m_]:=0/; n<=1||m<=0
b[n_, m_]:=b[n, m]=2Sum[p[n-m, k], {k, m, n-m}]+bb[n, m, b]+2bb[n, m, c]+2Sum[(r-1)c[n-m-r, m-r], {r, 2, m-1}]
c[n_, m_]:=0/; n<=1||m<=0
c[n_, m_]:=c[n, m]=p[n-m, m-1]+cb[n, m, b]+2cb[n, m, c]+Sum[(r-1)c[n-m-r, m-1-r], {r, 2, m-2}]
p[n_, m_]:=a[n, m]+b[n, m]+c[n, m]
Table[Sum[p[n, m], {m, (n+1)/2}], {n, 20}]
|