<s>[INST] 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?
 [/INST] As $\sum\limits_{i=1}^ni^3=\frac14 n^2(n+1)^2$ we consider cases $n=2k$ and $n=2k-1$.

*

*$n=2k$, $\ \frac14 n^2(n+1)^2=(n+5)\left(2 k^3 - 3 k^2 + 8 k + \frac{100}{2 k + 5} - 20\right)$ so $(2k+5)|(100-17)$, but $100-17=83$ is a prime, thus $2k+5=83$ and $n=78$.

2a. $n=4k+1$, $\ \frac14 n^2(n+1)^2-17=(n+5)\left(16 k^3 + 13 k + \frac{83}{2 (2 k + 3)} - \frac{33}{2}\right)$ thus $\frac{83}{2 (2 k + 3)} - \frac{1}{2}$ should be a whole number, thus $\frac{83}{ (2 k + 3)}$ should be odd integer, $(2 k + 3)|83$, $k=40$ and $n=4k+1=161$
2b. $n=4k+3$, $\ \frac14 n^2(n+1)^2-17=(n+5)\left(16 k^3 + 24 k^2 + 25 k + \frac{83}{4 (k + 2)} - 8\right)$ thus $\frac{83}{4 (k + 2)}$ should be a whole number, however, it's not the case as $4\not|83$.
So the answer is $78+161$.
</s>