Why are the last two digits of a perfect square never both odd?
Earlier today, I took a test with a question related to the last two digits of perfect squares.
I wrote out all of these digits pairs up to $20^2$.
I noticed an interesting property, and when I got home I wrote a script to test it. Sure enough, my program failed before it was able to find a square where the last two digits are both odd.
Why is this?
Is this always true, or is the rule broken at incredibly large values?
Taking the last two digits of a number is equivalent to taking the number $\bmod 100$. You can write a large number as $100a+10b+c$ where $b$ and $c$ are the last two digits and $a$ is everything else. Then $(100a+10b+c)^2=10000a^2+2000ab+200ac+100b^2+20bc+c^2$. The first four terms all have a factor $100$ and cannot contribute to the last two digits of the square. The term $20bc$ can only contribute an even number to the tens place, so cannot change the result. To have the last digit of the square odd we must have $c$ odd. We then only have to look at the squares of the odd digits to see if we can find one that squares to two odd digits. If we check the five of them, none do and we are done.
Others have commented on the trial method. Just to note that $3^2$ in base $8$ is $11_8$ which has two odd digits. This is an example to show that the observation here is not a trivial one.
But we can also note that $(2m+1)^2=8\cdot \frac {m(m+1)}2+1=8n+1$ so an odd square leaves remainder $1$ when divided by $8$.
The final odd digits of squares can be $1,5,9$ so odd squares are $10p+4r+1$ with $r=0,1,2$. $10p+4r$ must be divisible by $8$ and hence by $4$, so $p$ must be even.