I have a very interesting number theory problem. Let $$ S_n $$ be a number consisting of only $$n$$ ones. For instance, $$S_1=1\\S_2=11 \\ S_4=1111$$ The problem is to prove that the sum of the digits of $$S^2_n$$ can be calculated using the formula $$81\cdot \left( \left\lfloor \frac{n}{9} \right\rfloor + \left( \frac{n}{9} - \left\lfloor \frac{n}{9} \right\rfloor \right)^2 \right)$$
I would be very grateful for help. I don't even know how to start...