Find the number of sets of cardinality $m$ that are subsets of $\{1,\cdots,n\}$ such that the sum of the elements of the subset is divisible by $k$. For specific cases with small numbers, this works out fairly easily using straightforward enumeration and modular arithmetic. However, my question is: how do we solve this problem in general?  
 A: You can calculate the number of $m$-element subsets of $\{1 \ldots n\}$ where the sum of the elements in the subset equals $k$ with the generating function $\displaystyle\prod_{i=1}^n(1+xy^i)$, examining the coefficient of $x^my^k$. To get the number of subsets whose sum is divisible by $k$, you could simply add up the coefficients of $x^my^K$ for all multiples $K$ of $k$. However, it is probably more computationally efficient to expand the generating function product in the polynomial quotient ring $\mathbb{Z}[x,y]/\left<y^k-1\right>$; then the number you are looking for is the coefficient of $x^m$.
I don't know if Mathematica lets you calculate this way, but Magma does. You can test it at the Magma online calculator, with the following sample code:

m:=2;
k:=3;
Z<x,y>:=PolynomialRing(Integers(),2);
X:=quo<Z|y^k-1>;
for n in {1..20} do
  z:=&*[X!(1+x*y^i):i in {1..n}];
  n,Coefficient(Coefficient(z,1,m),2,0);
end for;
This code checks against the results in Julián Aguirre's comment above.
