Find the number of all subsets of $\{1, 2, \ldots,2015\}$ with $n$ elements such that the sum of the elements in the subset is divisible by 5 The problem is as in the question title. Only one addition - $n$ is not divisible by $5$.
I already have a solution involving permutations, but recently I read about generating functions and I was wondering if this problem can be solved with them. 
A similar problem is the following:
Find the number of all subsets of $\{1, 2, \ldots, 2015\}$ and the sum of elements in each subset is divisible by 5. The generating function used is $${((1+x^0)(1+x^1)(1+x^2)(1+x^3)(1+x^4))}^{403}.$$
But this function cannot be used for my problem, since we need to count how many elements have been "used" to make the subset. Can anyone help me?
 A: A generating function solution.
For every $S\subset\{1,2,\ldots,2015\}$ we will write $\Sigma S=\sum_{k\in S}k$.
Let
$$
f(a,x) = \prod_{k=1}^{2015} (1+a^kx) =
\sum_{S\subset\{1,\ldots,2015\}} a^{\Sigma S} x^{|S|}.
$$
Take the average this function over putting $5$th complex roots of unity for $a$. Let $\omega=e^{2\pi i/5}$; then
$$
\frac15\sum_{j=0}^4 f(\omega^j,x) = 
\sum_{S\subset\{1,\ldots,2015\}} \left(\frac15\sum_{j=0}^4 \big(\omega^{\Sigma S}\big)^j\right) x^{|S|} =
\sum_{\substack{S\subset\{1,\ldots,2015\}\\\Sigma S\equiv0\pmod5}} x^{|S|}.
\tag{$*$}
$$
On the RHS of $(*)$, the coefficient of $x^n$ is the number of $n$-element sets $S\subset\{1,\ldots,2015\}$ with $\Sigma S\equiv0\pmod5$.
On the other hand,
$$
f(\omega^j,x)= \begin{cases} (1+x)^{2015} & \text{if } j=0 \\
(1+x^5)^{403} & \text{if } j=1,2,3,4 \end{cases}
$$
so on the LHS of $(*)$ the coefficient of $x^n$ is: $\frac15\binom{2015}n$ if $n$ is co-prime with $5$, and
$\frac15\binom{2015}n+\frac45\binom{403}{n/5}$ if $5|n$.
A: The answer is $\frac{1}{5}\binom{2015}{n}$.
For each subset of $n$ elements (not necessarily with sum multiple of $5$) consider the set of the translations of the $n$-set. In other words, if we have $\{a_1,a_2\dots a_n\}$ Consider the family of sets of the form $\{r(a_1+k),r(a_2+k),\dots r(a_3+k)\}$ with $k\in\{0,1,\dots 2015\}$, and where $r(m)$ is simply the smallest positive integer congruent to $m\bmod 2015$.
By considering the equivalence relation of translation we split the $n-sets$ into some families,in each exactly one fifth of the subsets have sum multiple of $5$.
