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 ;-)