Find the sum of all positive integers $n$ such that when $1^3+2^3+3^3 +\dots+ n^3$ is divided by $n+5$ the remainder is $17.$ 
Find the sum of all positive integers $n$ such that when $1^3+2^3+3^3 +\dots+ n^3$ is divided by $n+5$ the remainder is $17.$

Letting $k= n+5$ we get that $1^3+2^3+3^3 +\dots+ (k-5)^3 \equiv 17 \text{ (mod $k$)}$.
Knowing the sum of cubes formula we get that ($\frac{(k-5)(k-4)}{2})^2\equiv 17 \text{ (mod $k$)}$.
From here I'm not sure how I should continue. What would be my options?

If $S_m=\sum_{r=1}^mr^3$
$$2S_{n+4}=\sum_{r=1}^{n+4}r^3+(n+5-r)^3\equiv0\pmod{n+5}$$ as $r^3+(n+5-r)^3\equiv0\pmod{n+5}, 1\le r\le n+4$
$$\implies2S_n\equiv-2[(n+4)^3+(n+3)^3+(n+2)^3+(n+1)^3]\pmod{n+5}$$
$$\equiv-2[(n+5-1)^3+(n+5-2)^3+(n+5-3)^3+(n+5-4)^3]$$
$$\equiv2(1^3+2^3+3^3+4^3)$$
$$\implies2S\equiv200\pmod{n+5}\text{ but we need  }2S\equiv34\pmod{n+5}$$
So, the necessary & sufficient condition is
$$200\equiv34\pmod{n+5}\iff (n+5)|(200-34)$$
