Prove that $W(n,\sum_{k=1}^{n}k^{2})=2(n-1)$ Let $F_{a}(n)$ be the digit sum of $n$ in base $a$,
define $W(a,b)=F_{a}(a^{\lceil\frac{\log{b}}{\log{a}}  \rceil}-b)$,
prove that $\displaystyle\ W(n,\sum_{k=1}^{n}k^{2})=2(n-1)$ if $n−1 \in 6\mathbb{N} \pm 1$.

For positive integers $n,k$, let
$$S(n,k)=\sum_{i=1}^{n}i^k$$
and for positive integers $m,b$, with $b>1$, let $D(b,m)$ be the sum of the base-$b$ digits of $m$.
Let $k=2$.
Thus, suppose $a$ is a positive integer such that $a \mid S(a,2)$, and let $b=a+1$.
Identically, we have
$$
S(n,2)
=
\sum_{i=1}^n i^2
=
\frac{n(n+1)(2n+1)}{6}
$$
hence
\begin{align*}
&a \mid S(a,2)\\[4pt]
\implies\;&a{\;|}\left(
\frac{a(a+1)(2a+1)}{6}
\right)\\[4pt]
\implies\;&6 \mid \left((a+1)(2a+1)\right)\\[4pt]
\implies\;&6 \mid \left(b(2b-1)\right)\\[4pt]
\implies\;&6 \mid b\;\;\text{or}\;\;\Bigl(2 \mid b\;\;\text{and}\;\;3 \mid (2b-1)\Bigr)\\[4pt]
\end{align*}
If $6 \mid b$, then
\begin{align*}
S(b,2)&=\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(b,2))
=
\left({\small{\frac{b}{3}}}\right)
+
\left({\small{\frac{b}{2}}}\right)
+
\left({\small{\frac{b}{6}}}\right)
=
b
$$
If $2 \mid b$ and $3 \mid (2b-1)$, then $b\equiv 2 \pmod3$, so
\begin{align*}
S(b,2)&=\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(b,2))
=
\left({\small{\frac{b+1}{3}}}\right)
+
\left({\small{\frac{b-2}{6}}}\right)
+
\left({\small{\frac{b}{6}}}\right)
=
b.
$$
Thus, for all subcases, we have $D(b,S(b,2))=b$.
So we are considering the summation $\sum_{i=1}^a i^2$ in base $a$. A quick observation yields
$$
a^{2+1} = \sum_{i=1}^a a^2 \geq \sum_{i=1}^a i^2 \geq a^2.
$$
See $W(b,S(b,2))=D(b,b^3-S(b,2))$
$\implies W(b,S(b,2))=3a+1-D(b,S(b,2))=2a$
and also note $a\in \{6t\pm 1\}$ then $a|S(a,2)$
