# Squaring numbers that end with the digit 5

So I came across this neat pattern that I noticed, and so far I've only checked it for 5, and some two digit numbers that end with 5 and 3 digit numbers that end with 5.

The rule seems to be, if a number ends with 5, aside from 5 itself then the square will be a composition of 25 being the right most digits and then all digits after are equal to the square of the original number excluding the 5, plus that number again excluding the five. (below $ba$ is not a product)

So say $a$ will be the last two digits, and $b$ will be all of the other digits.

$$15^2=$$ $$a=5^2$$ $$b = 1^2 + 1$$ $$15^2 =ba= 225$$

and

$$2125^2$$ $$a=5^2$$ $$b=212^2 + 212$$ $$2125^2 = 4515625$$

Is this called anything in mathematics? Is there a way to prove this will be the behavior for all N digits numbers that end with 5.

• I still use the rule that a number ending with 5gives a square that's an oblong number, $n(n+1)$, with 25 tacked on. – Oscar Lanzi Sep 10 '16 at 23:30
• This trick is listed here: en.wikipedia.org/wiki/… – Frank Vel Sep 14 '16 at 12:53

## 3 Answers

If $n$ ends in $5$, we can write $n$ in the form $10k+5$ for some integer $k$. Then

$$n^2=(10k+5)^2=100k^2+100k+25=100(k^2+k)+25\;.$$

Clearly $100(k^2+k)$ ends in $00$, so $n^2$ ends in $25$.

• To answer the "is this called anything in mathematics" question: It's a special case of a square of a binomial, $$(a+b)^2 = a^2+2ab+b^2$$ – Guntram Blohm Sep 11 '16 at 5:17
• Yet another way to look at it is that (=5 mod 10) * (=5 mod 10) = (=25 mod 100). Is there a standard notation for modular arithmetic with mixed moduli? – John Dvorak Sep 11 '16 at 10:35
• It's definitely not true in general that $(a\mod m)*(b\mod n) = (ab\mod mn)$. Indeed, in general the answer is well-defined only $\mod\gcd(m,n)$, not $\mod mn$. Even if $a=b$ and $m=n$, this is not true in general. And any attempt to figure out an algebraic-seeming rule will rely on this simple argument anyway to determine validity, so it's best to just stick with the simple argument. – Greg Martin Sep 11 '16 at 20:50

$$(10n + 5)^2 = 100 n^2 + 100n + 25 = 100n(n + 1) + 25.$$

$\text{ }$

• And this n(n+1) shows how to easy get the other digits. – marty cohen Sep 11 '16 at 5:10

Square of Every number ending in 5, say x5, is equal to x*(x+1) followed by 25. Number ending in 5 can be represented as 10n +5

(10n +5)^2 = 100n^2 + 100n+25= 10n * 10 (n +1) + 25.

A Vedic mathematics trick