<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] Let $$S:=\sum_{k=1}^{n} k^{3}=\left[\frac{n}{2}(n+1)\right]^{2}$$
Then  $$\begin{aligned} 4S &=[n(n+1)]^{2} \equiv[-5(-5+1)]^{2}\equiv 400 \quad (\operatorname{mod} n+5) \end{aligned}$$
Given that $S \equiv 17 \bmod (n+5)$, we have
$$
\begin{array}{l}\quad  4(17) \equiv 400 \quad (\bmod n+5) \\
\Rightarrow n+5 \mid 400-4(17)=2^{2} \times 83 \\
\Rightarrow n+51=83,2 \times 83 \text { or } 2^{2} \times 83 \text { (rejected) } \\
\Rightarrow n=78 \text { or } 161
\end{array}
$$
</s>