Welcome to NRICH.

 
Chains - reordering digits


By Anonymous on Tuesday, August 29, 2000 - 09:48 pm:

I have been working through a problem solving book this summer in my spare time. However I have come across a problem that has stumped me and was wondering if it would be possible to get some advice on how to express it algebraically so I can further it. I would really appreciate some help:
'Chains -reordering digits'
Any 4 digit number is rewritten with its digits arranged in ascending and descending order of size. The smaller is then subtracted from the larger and the process is repeated.
eg. 7345 gives 7543-3457=4086
4086 gives 8640-0468=8172
Then write 7543->8640->8721....
Complete this chain then try other 3,4,5,6 digit numbers.

All the chains of 4 i have tried end in 7641
All the chains of 3 I have tried end in 954
But the pattern for 5 digit numbers varies and if you can help me work out the algebra to explain 3 and 4 digit numbers, maybe I can explain the pattern for 5 and 6 digit numbers myself. Please help.
Cheers!
(aged 17)


By Harry Smith (Harry) on Wednesday, August 30, 2000 - 11:03 am:

There isn't really a universal method for problems like this - you just have to have a play around and try and see what is going on. One tip though, is to right a number like 731 as (7)(100)+(3)(10)+(1). By expanding the digits like this you can write an arbitrary three digit number abc as 100a+10b+c.

If you apply this method to the simplest case of your problem, the three digit numbers you can see that the three digit number abc goes to:

(100a+10b+c) - (100c+10b+a)

or: 99a - 99c = 99(a-c)

(I am assuming that a>c - it doesn't really matter)

So a three digit number abc goes to "99 times the difference between a and c". This difference can be any whole number between 0 and 9. So you only have 9 possible outcomes. Now you can look at where those outcomes take you. For example, if you started your sequence at 983, the difference between a and c is 6, so the second member of your sequence is 6 x 99 = 594. (Check this: 983 - 389 = 594). Now for 594 the difference between a and c is 1. So a difference of 6 in one term leads to a difference of 1 in the next term. Try drawing an arrow diagram to show this. Write the numbers from 1 to 9. Draw an arrow from 6 to 1. Try some numbers with other differences and see which differences lead to which. You should see that regardless of where you start you will end up with a difference of 1. (Unless you start at a palindromic number, eg 767, 212 or 929 - these will take you straight to zero!).

When you find the next term of the sequence after you have reached a difference of 1, you get 99. Now it depends what you do with 99. You can either say 99 - 99 = 0, and you have shown that all sequences end at zero.

Alternatively, you can say that 990 - 099 = 891. Then all sequences (except those starting with palindromic numbers) end in a cycle that goes:

891 > 693 > 297 > 495 > 99 > 891

So that's that problem cracked.

Have a closer look at the four digit version yourself. Try writing the number as 1000a+100b+10c+d. Talk about any special cases (situations that behave differently from the normal rule, such as sequences starting with palindromic numbers). See if you can find any numbers that give themselves, or any cycles like the one above. There are stacks of problems like this (one such problem sends numbers onto the sum of their proper factors - numbers which give themselves in this sequence are called perfect numbers).

Have fun.

Harry


By Charlotte Rae (P2859) on Monday, October 9, 2000 - 09:13 pm:

Heya Harry

Thanks for the help..... I've gone away and carried on for 4, 5 and 6 digit numbers but I've come to try and do it for n digits and have yet again come unstuck. Your sound knowledge would yet again be appreciated:
What I know so far -
4 digits:- 999x + 90y (x is (a-d) and y is (b-c)
sequences converge to 7641
5 digits:- 9999x + 990y (x is (a-e) and y is (b-d)
sequences converge to 97641
6 digits:- 99999(a-f) + 9990(b-e) + 900(c-d)
sequences converge to 876420

To get the equation for n digits, you seem to have (n-1) number of 9's multiplied by x
plus (n-3) number of 9's and a 0 multiplied by y
plus (n-5) number of 9's and 2 0's multiplied by z and so it goes on. How can this be expressed better and how can I work out what each sequence will converge to if it consists of n digits?
Urgent assistance needed! Thanks!
(still aged 17)


Any further thoughts can be posted to Ask NRICH. - The Editor