g[11]

g[37]

n=0;

Clear[g]

g[n_Integer]/;n≥11:=g[n]=Expand[g[n-2]f[2]-g[n-2]-g[n-4]]
g[9]=2g[5]+2g[3]+g[1];
g/:g[k_]f[2]:=g[k+2]+g[k]+g[k-2]

g/:g[-4n+1]f[2]=g[-4n+3];
g/:g[-4n+2]f[2]=g[-4n+3]+g[-4n+1];

g[9]

g[11]

g[13]

g[15]

Table[{k,g[37]

n=1;

Clear[g]

g[n_Integer]/;n≥11:=g[n]=Expand[g[n-2]f[2]-g[n-2]-g[n-4]]
g[9]=2g[5]+2g[3]+g[1];
g/:g[k_]f[2]:=g[k+2]+g[k]+g[k-2]

g/:g[-4n+1]f[2]=g[-4n+3];
g/:g[-4n+2]f[2]=g[-4n+3]+g[-4n+1];

g[13]

g[15]

n=2;

Clear[g]

g[n_Integer]/;n≥11:=g[n]=Expand[g[n-2]f[2]-g[n-2]-g[n-4]]
g[9]=2g[5]+2g[3]+g[1];
g/:g[k_]f[2]:=g[k+2]+g[k]+g[k-2]

g/:g[-4n+1]f[2]=g[-4n+3];
g/:g[-4n+2]f[2]=g[-4n+3]+g[-4n+1];

g[17]

g[19]

g[21]

g[23]

g[25]

g[27]

g[29]

g[31]

g[33]

Table[{k,Coefficient[g[k-4n+1],g[1-4n]]},{k,8(n+1),32(n+1),2}]

n=3;

Clear[g]

g[N_,k_Integer]/;k≥11:=g[N,k]=Expand[g[N,k-2]f[2]-g[N,k-2]-g[N,k-4]]
g[N_,9]:=2g[N,5]+2g[N,3]+g[N,1]
g/:g[N_,k_]f[2]/;k≥-4N+3:=g[N,k+2]+g[N,k]+g[N,k-2]

g/:g[N_,k_]f[2]/;k==-4N+1:=g[N,-4N+3]
g/:g[N_,k_]f[2]/;k==-4N+2:=g[N,-4N+3]+g[N,-4N+1]

g[3,13]

With[{n=3},Table[{k,Coefficient[g[n,k-4n+1],g[n,1-4n]]},{k,8(n+1),16(n+1),2}]]

CountHoms[n_,k_]:=Coefficient[g[n,k-4n+1],g[n,1-4n]]

%[[All,2]]

{1,1,2,2,6,10,18,34,62,114,210,386}/{1,2,2,6,10,18,34,62,114,210,386,710}

N[1/%]

PartitionsP

ListPlot[%]

Length[Cases[Compositions[32,3],l_/;Max[l]≤11]]

<<Combinatorica`

Clear[CountCompositions]

TODO : do this properly

CountCompositions[n_,k_Integer/;k>0,m_:∞]:=Length[Cases[Compositions[n,k],l_/;Max[l]≤m]]

CountCompositions[0,k_Integer,m_:∞]:=If[k==0,1,0]

CountCompositions[n_,0,m_:∞]:=If[n==0,1,0]

CountSTrains[n_,k_]:=CountSTrains[n,k]=Sum[CountCompositions[4(n+1)s-k/2,s-1,4(n+1)-1],{s,1,k/2+1-4(n+1)}]

With[{n=2},Table[CountSTrains[n,k]-CountHoms[n,k],{k,8(n+1),36,2}]]

CountHoms[2,32]