A riddle involving series.

If $n>0$ is the number of children and we denote by $c_k$ the number of coins left after the first $k$ children have taken their share, we have

$$ c_{k+1} = \frac{6}{7} \bigl(c_k - (k+1)\bigr) ~~~\text{ for } k=0,\ldots,n-1 \enspace, $$

with $c_n = 0$. Applying generating functions,

$$ C(x) \biggl(\frac{1}{x} - \frac{6}{7} \biggr) = \frac{c_0}{x} - \frac{6}{7}\biggl(\frac{nx^n}{x-1} - \frac{x^n-1}{(x-1)^2}\biggr) \enspace. $$

Taking $x=\frac{7}{6}$, the left-hand side vanishes and we can solve for $c_0$:

$$ c_0 = 36 + 6 (n-6)\biggl(\frac{7}{6}\biggr)^{\!n} \enspace. $$

The only positive value of $n$ for which $c_0$ is an integer is $6$. Hence $c_0=36$.