Sunday Times Teaser 2794 – D-day
by Graham Smithers
Published: 10 April 2016 (link)
I have a particular digit in mind and I shall call it D. I have written down a number consisting of D digits in which the penultimate digit is D itself. If I move that penultimate digit to the left so that it becomes the first digit, then I get a new D-digit number that turns out to be D times the number I started with.
What is the D-digit number I started with?
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415# For integers 2 < D < 10, 0 <= y < 10 and x we have:## D.(100.x + 10.D + y) == D.10^(D - 1) + 10.x + y## (10.D - 1).x == D.10^(D - 2) - (D - 1).y / 10for D in range(3, 10):for y in range(10):t, r = divmod((D - 1) * y, 10)if not r:x, r = divmod(D * (10 ** (D - 2) - D) - t, 10 * D - 1)if not r:print(f"The number is {100 * x + 10 * D + y}.")