<s>[INST] The remainder of $1^2+3^2+5^2+7^2+\cdots+1013^2$ divided by $8$ How to find the remainder of $1^2+3^2+5^2+7^2+\cdots+1013^2$ divided by $8$
 [/INST] As Ishan has suggested, $(2m+1)^2=4m^2+4m+1=8\frac{m(m+1)}2+1\equiv1\pmod8$
So, $\sum_{0\le r\le n}(2r+1)^2\equiv\sum_{0\le r\le n}1\pmod 8\equiv n+1\pmod8$
For $1013=2\cdot506+1,$ so $n=506\implies \sum_{0\le r\le 506}(2r+1)^2\equiv 507\pmod8\equiv3$
</s>