Alexander Bass
This note is one of many taken during 2025

Squares mod 100

Two neat little identities for squares mod 100.

n2(n+50)2mod100 n^2\equiv (n+50)^2 \mod 100

And

n2(50n)2mod100 n^2\equiv (50-n)^2 \mod 100

These can be algebraically shown to be true

n2(n2+2500+100n)mod100 n^2 \equiv (n^2 + 2500 + 100n) \mod 100

What about the generic case of a modulus kk? What is the specific mm to be added to nn to make the squares congruent?

n2(n+m)2modk n^2 \equiv (n+m)^2 \mod k

Expand

n2(n2+m2+2mn)modk n^2 \equiv (n^2 + m^2 + 2mn) \mod k

The trivial case is for m20modkm^2 \equiv 0 \mod k and 2mn0modk2mn \equiv 0 \mod k. Let’s just ignore the possibility that both of those aren’t true and yet still (m2+2mn)0modk(m^2 + 2mn) \equiv 0 \mod k

The smallest natural number mm such that 2mn0modk2mn \equiv 0 \mod k for any integer nn is clearly k/2k/2 if kk is even, and kk if kk is odd.

The smallest natural number mm such that m20modk m^2\equiv 0 \mod k is a bit trickier.

m2=k2m^2 = k^2 Obviously works, but the case of m2=(k/2)2m^2 = (k/2)^2 only works if kk is divisible by 44

m=k2 m = \frac{k}{2} m2=k222 m^2 = \frac{k^2}{2^2} m2k=k4 \frac{m^2}{k} = \frac{k}{4}

So for

n2(n+m)2modk n^2 \equiv (n+m)^2 \mod k

If kk is divisible by 44

m=k/2 m = k/2

Otherwise:

m=k m = k
This note is one of many taken during 2025