Sunday Times Teaser 2574 – Higher Powers
by Richard England
Published: 21 January 2012 (link)
I have chosen two different two-figure numbers. They use the same two digits as each other, but in different orders. If I start with either number and raise it to a power equal to either of the two numbers, then I find that the answer is a number whose last two digits form the number with which I started.
What are my two numbers?
One Comment
Leave one →
-
Brian Gladman permalink123456789from itertools import combinationsfor a, b in combinations(range(10), 2):u, v = 10 * a + b, 10 * b + aif pow(u, u, 100) == pow(u, v, 100) == u:if pow(v, v, 100) == pow(v, u, 100) == v:print('The two numbers are {} and {}.'.format(u, v))