Question on sum of digits of squares Let $D$ be the function define as $D(b,n)$ be the sum of the base-$b$ digits of $n$.
Example: $D(2,7)=3$ means $7=(111)_2\implies D(2,7)=1+1+1=3$
Define $S_m(a)=1^m+2^m+3^m+...+a^m$ where $a,m\in\mathbb{Z}_+$

Can it be shown that
(1)$$D(a,S_2(a))\le 2(a-1)?$$
(2) $$D(a,S_2(a))< a\iff a\equiv5\mod6?$$

Note: For $a,m>1$
● $a^m<S_m(a)<a^{m+1}$
● $1\le D(a,S_m(a))\le(a-1)(m+1)$ 
● $D(a,S_m(a))=1+D(a,S_m(a-1))$proof

Edit 
● $a\mid S_2(a)$ then  $D(a+1,S_2(a+1))=a+1$
Proof: 

 let $b=a+1$.

Identically, we have
$$
S_2(n)
=
\sum_{i=1}^n i^2
=
\frac{n(n+1)(2n+1)}{6}
$$
hence
\begin{align*}
&a{\,|\,}S_2(a)\\[4pt]
\implies\;&a{\;|}\left(
\frac{a(a+1)(2a+1)}{6}
\right)\\[4pt]
\implies\;&6{\;|}\left((a+1)(2a+1)\right)\\[4pt]
\implies\;&6{\;|}\left(b(2b-1)\right)\\[4pt]
\implies\;&6{\,|\,}b\;\;\text{or}\;\;\Bigl(2{\,|\,}b\;\;\text{and}\;\;3{\;|\,}(2b-1)\Bigr)\\[4pt]
\end{align*}
If $6{\,|\,}b$, then
\begin{align*}
S_2(b)&=\frac{b(b+1)(2b+1)}{6}\\[4pt]
&=\frac{b^3}{3}+\frac{b^2}{2}+\frac{b}{6}\\[4pt]
&=
\left({\small{\frac{b}{3}}}\right)\!{\cdot}\,b^2 
+
\left({\small{\frac{b}{2}}}\right)\!{\cdot}\,b^1
+ 
\left({\small{\frac{b}{6}}}\right)\!{\cdot}\,b^0
\end{align*}
hence
$$
D(b,S_2(b))
=
\left({\small{\frac{b}{3}}}\right)
+
\left({\small{\frac{b}{2}}}\right)
+
\left({\small{\frac{b}{6}}}\right)
=
b
$$
If $2{\,|\,}b\;\;$and$\;\;3{\;|\,}(2b-1)$, then $b\equiv 2\;(\text{mod}\;3)$, so
\begin{align*}
S_2(b)&=\frac{b(b+1)(2b+1)}{6}\\[4pt]
&=\frac{b^3}{3}+\frac{b^2}{2}+\frac{b}{6}\\[4pt]
&=
\left({\small{\frac{b+1}{3}}}\right)\!{\cdot}\,b^2 
+
\left({\small{\frac{b-2}{6}}}\right)\!{\cdot}\,b^1
+ 
\left({\small{\frac{b}{2}}}\right)\!{\cdot}\,b^0
\end{align*}
hence
$$
D(b,S_2(b))
=
\left({\small{\frac{b+1}{3}}}\right)
+
\left({\small{\frac{b-2}{6}}}\right)
+
\left({\small{\frac{b}{6}}}\right)
=
b
$$
Thus, for all cases, we have $D(b,S_2(b))=b$.


We can continue your casework on $ n \pmod{6}$.   
Here's a sketch of it. Fill in the rest of the details yourself. 
If $ n \equiv 0 \pmod{6}$, then $ \frac{ 2n^3 + 3n^2 + n } { 6} = \frac{2n}{6} \times n^2 + \frac{3n}{6} \times n + \frac{n}{6} \times 1 $,
 so $D_2 = \frac{2n}{6} + \frac{3n}{6} + \frac{n}{6} = n $.
If $ n \equiv 1 \pmod{6}$, then $ \frac{ 2n^3 + 3n^2 + n }{6} = \frac{ 2n-2}{6} \times n^2 + \frac{ 5n - 5 } { 6} \times n + \frac{ n + 5 } { 6}\times 1  $,
so $D_2 = \frac{ 2n-2}{6}  + \frac{ 5n-5}{6} + \frac{n+5}{6} = \frac{ 8n-2}{6}$.
If $ n\equiv 2 \pmod{6}$, then $  \frac{ 2n^3 + 3n^2 + n }{6} = \frac{2n - 4}{6} \times n^2 +  \ldots$
so $D_2 = \ldots $
$\vdots$
If $ n \equiv 5 \pmod{6}$, then $ \frac{ 2n^3 + 3n^2 + n }{6} = \frac{2n+2}{6} \times n^2 + \frac{n+1}{6} \times n + 0 \times 1 $,
 so $D_2 = \frac{2n+2}{6} + \frac{n+1}{6} = \frac{3n+3}{6} < n$.   

I have not done the rest as yet, but I believe it will all work out (assuming the statement is true). I'd be happy to review your algebra if you are unable to conclude that $D_2  \leq 2 (n-1)$ and $ D_2 < n \iff n\equiv 5 \pmod{6}$. 
