\datethis @*Introduction. This is a quick-and-dirty program related to exercise 3.6--14. I'm finding how many terms appear in the representation of $z^n$ with respect to bases of the form $z^0$, \dots,~$z^{t-1}$, $z^{n-r+t}$, \dots,~$z^{n-1}$, modulo $z^r+z^{r-s}+1$ and mod~2, where $1\le t\le r$. @d r 100 /* the longer lag */ @d s 37 /* the shorter lag */ @d n 400 /* the number of elements generated simultaneously by |ran_array| */ @c #include @ main() { register int i,j,k,m,t; @; while (t) { @; t--; @; } @; } @ The representation of $z^k=a_{k0}z^{b_0}+\cdots+a_{k(r-1)}z^{b_{r-1}}$ appears in arrays |a| and~|b|. The largest power of~$z$ less than $z^n$ that is not in the basis is $z^m$. @= int a[n+1][r]; /* I could make this |char|, but |int| aids debugging */ int b[r]; /* identifies the basis */ int c[r],d[n+2]; /* for working storage */ int p[n]; /* is this power of $z$ in the basis? */ @ @= for (k=0;k= for (k=m;a[k][t]==0;k--) ; b[t]=k; for (j=0;j=t;k--) if (a[k][t]) for (j=0;j= { register int forbidden=0; for (j=0,i=0;j=t) forbidden=1; else i++; } if (forbidden) @@; else stat[i]++; } @ @= int stat[r+1]; /* the number of cases with a given number of nonzero terms */ @ @= { for (i=0;in) i=n; printf("..%d",i-1); } printf("\n"); } @ @= for (j=0;j<=r;j++) printf(" %3d: %d\n",j,stat[j]); @* Index.