Automorphic Numbers MATLAB help

1 view (last 30 days)
Ryan Kovarik
Ryan Kovarik on 4 Sep 2015
Answered: Walter Roberson on 4 Sep 2015
Here is a question that was asked; can anyone actually compute this:
A k digit automorphic, or circular, number is a number whose square ends in the same k digits as the number itself. For example, 76 is a 2-digit automorphic number because 76^2=57 76. K-digit automorphic numbers are said to come in pairs. What is the leftmost (that is, most significant) digit of each of the two 1,001-digit, base-10, automorphic numbers?

Answers (1)

Walter Roberson
Walter Roberson on 4 Sep 2015
I worked this out numerous years ago. It turns out there is a simple structure to the pairs. The sum of the two K-digit automorphic numbers is (10^K + 1). One of them will always end in 5 and the other will always end in 6. Furthermore if you square the one ending in 5, and take the digit to the left of the original value in the square (the K+1 digit counting from the right) then it is the first digit of next value ending in 5. For example,
5^2 = 25, and the two digit automorphic number ending in 5 is 25.
25^2 = 625, and the three digit automorphic number ending in 5 is 625.
625^2 = 390625 and the 4 digit automorphic number ending in 5 is 0625
0625^2 = 390625 and the 5 digit automophic number ending in 5 is 902625
10001-0625 = 9376 and 9376^2 = 87909376 so 9376 is the 4 digit automorphic number ending in 6.
There is also a shortcut to calculating what the next digit is for the 5 case, which you could discover with a bit of algebra. But it is your homework and implementation is your problem ;-)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!