<s>[INST] Number theory problems. It is given: $3m+1=$perfect square. Express $m+1$, as the sum of $3$ perfect squares. 
I tried to solve the problem by checking for odd and even values perfect squares $4k^2,{(2k+1)}^2$. I got somewhat convincing form of result from $3m+1={(2k+1)}^2$: 
$m+1=\dfrac43(k^2)+\dfrac43(k)+1,$ so that $k$ must be a multiple of $3$,
 but I could not find the exact value of $k$, so that RHS is a perfect square. 
as for the part $3m+1=4k^2$, I am hopeless.
Help please.
 [/INST] $3m + 1 = n^2$. This means: $n = 3k - 1$ or $n = 3k + 1$. If $n = 3k + 1$ then:
$m = \dfrac{n^2 - 1}{3}$, so $m + 1 = \dfrac{n^2 + 2}{3} = \dfrac{(3k + 1)^2 + 2}{3} = \dfrac{9k^2 + 6k + 3}{3} = 3k^2 + 2k + 1 = k^2 + k^2 + (k+1)^2$.
The other case is similar.
</s>