Article 140H4 Curious numbers

Curious numbers

by
John
from John D. Cook on (#140H4)

A an n-digit number is said to be curious if the last n digits of its square are the same as the original number. For example, 252 = 625 and 762 = 5776. (Curious numbers are also known as automorphic numbers.)

There are bigger curious numbers, such as 212890625 and 787109376:

2128906252 = 45322418212890625

and

7871093762 = 619541169787109376.

And if the square of x has the same last n digits as x, so does the cube of x and all higher powers.

It turns out that for each n > 1, there are two curious numbers of length n.

Always two there are; no more, no less. - Yoda

There's even a formula for the two solutions. The first is the remainder when 5 to the power 2n is divided by 10n and the second is 10n + 1 minus the first.

Here's a little Python code to show that the first several solutions really are solutions.

for i in range(2, 20): a = 5**(2**i) % 10**i b = 10**i - a + 1 print((a**2 - a)%10**i, (b**2 - b)%10**i)
aGZVEH2f5NU
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments