<s>[INST] Interesting Base summation contest math problem The problem is as follows:
Let $N_b=1_b+2_b+\cdots+100_b$ where $b$ is an integer greater than $2$. Compute the number of values of $b$ for which the sum of the squares of the digits of $N_b$ is at most $512$.
I originally tried to find the maximum case for which this held true, by going until it no longer worked, but I realized that being less than or equal to $512$ was an intermittent pattern that might not be easy to tell when it stopped. We were given $20$ minutes, no calculators. If I remember correctly, I think the answer happened to be $30$. Can anyone tell me why it is this and how to prove it quickly?
 [/INST] Observe that $$N_b= 101_b\left(\frac{100_b}{2}\right)=\frac{b^4+b^2}{2}=b^2\left(\dfrac{b^2+1}{2}\right).$$
If $b$ is odd, 
$$b^2\left(\frac{b^2+1}{2}\right)=b^2\left(\frac{b-1}{2}b+\frac{b+1}{2}\right)=\frac{b-1}{2}b^3+\frac{b+1}{2}b^2+0b+0,$$
so $N_b = \left(d_3d_2d_1d_0\right)_b$ where $d_3=\dfrac{b-1}{2}d_2=\dfrac{b+1}{2}$ and $d_1=d_0=0$, and the sum of the squares of the digits of $N_b$ is $(\dfrac{b-1}{2})^2+(\dfrac{b+1}{2})^2$.
If $b$ is even, 
$$b^2\left(\frac{b^2+1}{2}\right)=(b^2+1)\left(\frac{b^2}{2}\right)=\frac{b}{2}b^3+0b^2+\frac{b}{2}b+0,$$
so $N_b = \left(d_3d_2d_1d_0\right)_b$ where $d_3=\dfrac{b}{2},d_2=0,d_1=\dfrac{b}{2},$ and $d_0=0$, and the sum of the squares of the digits of $N_b$ is $2(\dfrac{b}{2})^2$.
It’s not hard to see that $N_b$ is an increasing sequence in $b$, and that the sum of the digits in $N_{32}=(g0g0)_{32}$ is 512. 
</s>