# Interesting numerical games

Discussion in 'Physics & Math' started by James R, Oct 11, 2019 at 6:59 AM.

1. ### James RJust this guy, you know?Staff Member

Messages:
33,248
Game #1

Try this:

A. Pick any 4 digit number with at least 2 digits that are different. This is your starting number.
B. Arrange the digits of the number from highest to lowest, to get a new number.
C. Arrange the digits of the original number from lowest to highest, to get a new number. Leading zeros are allowed.
D. Subtract the number you obtained in step C from the number you obtained in step B to get a new number. This is your new starting number.
Repeat steps 2, 3 and 4 for a while and post about what you notice. Try starting with a different 4 digit number and see what happens.

====
Example of the process.
B. Arrange digits from highest to lowest to get 9410.
C. Arrange digits from lowest to highest to get 0149.
D. 9410 - 0149 = 9261.
Now repeat the process with 9261...
B. Arrange digits from highest to lowest to get 9621.
C.

etc.

====
By the way, the instruction in A that at least two digits should be different is to avoid the following kind of boredom:
B. Arrange to get 7777.
C. Arrange to get 7777.
D. 7777-7777=0000.
From now on you just get 0000 all the time.

Last edited: Oct 11, 2019 at 7:05 AM

3. ### James RJust this guy, you know?Staff Member

Messages:
33,248
Game #2

2. Write down all factors of the integer that are less than the integer itself.
3. Add up all the factors to get a number.
4. Repeat for other integers. Do you notice anything about the results you end up with in step 3, for the various integers?

====
One way to approach this is to do it systematically, starting with, say, the numbers from 1 to 10. So...

1. Consider the number 1.
2. 1 has no factors less than 1.
3. There's nothing to add, so the result for the number 1 is: zero.

1. Consider the number 2.
2. 2 is 2 times 1, so its only factor less than 2 is the number 1.
3. The sum of all the factors in this case is 1.

....

1. Consider the number 12.
2. $12 = 1 \times 12 = 2 \times 6 = 3 \times 4$, so the factors less than 12 are: 1, 2, 3, 4, 6.
3. Add them up and the sum is $1+2+3+4+6=16$ for the number 12.

etc.

Is there a pattern?
Actually, this one is kind of obvious if you think about it, at least for one particularly important class of numbers.

Last edited: Oct 11, 2019 at 7:52 AM

5. ### DaveC426913Valued Senior Member

Messages:
12,962
Well that's interesting...
I forget how to do spoilers: [ 6174?]

7. ### James RJust this guy, you know?Staff Member

Messages:
33,248
There are [spoiler][/spoiler] tags, so not too hard.

8. ### BaldeeeValued Senior Member

Messages:
1,824
No pattern.
If you think it a pattern that that class of number has that characteristic when it is pretty much the definition of that class of number...
It’s like saying if you identify all the even numbers, the pattern is that they’re all even!

Or maybe I’ve missed something?

9. ### TheFroggerValued Senior Member

Messages:
1,911
Shouldn't step B be 9401?

10. ### DaveC426913Valued Senior Member

Messages:
12,962
This is very similar to the Collatz Conjecture, which fascinated me for a while a few years back (though I didn't know it was called that), while on a long plane flight with little but a pencil and paper.

...start with any positive integer n. Then each term is obtained from the previous term as follows:
if the previous term is even, the next term is one half the previous term.
If the previous term is odd, the next term is 3 times the previous term plus 1.
The conjecture is that no matter what value of n, the sequence will always reach 1
https://en.wikipedia.org/wiki/Collatz_conjecture

What happens is some numbers reach one very quickly, while others right next to it take a very very long time to reach 1.
So:
1: 1
2: 2>1
3: 3>10>5>16>8>4>2>1
..
11: 11>34>17>52>26>13>40>20>10 (previously solved).
27: 27>82>41>124>62>31>94>47>142>71>214>107>322>161>484>242>121>364>182>91>274>137>411>1234>617>1852>926>463>1390>...

Charting this is kind of cool. It's like a tree limb with branches.

Here are numbers 1 through 26:
27 is too long to fit on-screen.

11. ### James RJust this guy, you know?Staff Member

Messages:
33,248
Regarding Game #1:
The answer you get, after a maximum of 7 cycles through the instructions, is called Kaprekar's constant, the number 6174, named after Indian mathematician D.R. Kaprekar.

There are similar numbers for numbers with different numbers of digits. For example, if you start with a 3 digit number, you end up with 495.

Interestingly when we try it with 5 digit numbers, we tend to end up in a loop, where certain numbers repeat.

12. ### James RJust this guy, you know?Staff Member

Messages:
33,248
Regarding Game #2:

Of course, all of the prime numbers have a sum of 1, because their only factors are 1 and the number itself.

The given sum is called the aliquot sum for a particular number. This is used to define certain other classes of number:

Prime numbers have an aliquot sum of 1.
Perfect numbers have an aliquot sum equal to the number itself. An example is 6 = 1 + 2 + 3.
Deficient numbers have an aliquot sum less than the number itself (for example the nunber 4, or 8).
Abundant numbers have an aliquot sum greater than the number itself (for example, 12, whose aliquot sum is 16).
Untouchable numbers are numbers that that are not the aliquot sum of any other number.

There are some interesting unproven conjectures. For example, it is conjectured that the number 5 is the only odd untouchable number. It was noticed back in 1000 CE that 5 is untouchable, as is 2. The modern mathematician Erdos proved that there is an infinite number of untouchable numbers. It turns out that if Goldbach's conjecture is true, then 5 is the only odd untouchable number, but that conjecture remains a famous unsolved problem in maths.

https://en.wikipedia.org/wiki/Aliquot_sequence
https://en.wikipedia.org/wiki/Aliquot_sum

Baldeee likes this.
13. ### DaveC426913Valued Senior Member

Messages:
12,962
Attached are all outcomes, from 0001 to 9999. They all converge on 6174.

(Only took me a couple of hours in JavaScript, most of which was unit-testing my helper functions.)

#### Attached Files:

• ###### all-sequences.txt
File size:
156.2 KB
Views:
3
gebobs likes this.
14. ### DaveC426913Valued Senior Member

Messages:
12,962
I found it interesting to note that:
If you do this trick with 2 digit numbers, the sum of the digits of the final number always equals 9 ( eg.: 4-47=27 and 2+7=9 )

If you do this trick with 4 digit numbers, the sum of the digits of the final number always equals either 18 or 27.

I wonder what 3 digits does...

15. ### BaldeeeValued Senior Member

Messages:
1,824
Well, what do you know!
I learn something new every day!

16. ### DaveC426913Valued Senior Member

Messages:
12,962
Huh. What I think is even more wild is that they don't know 'why 6174??' - in fact, they can't be sure that there's any deeper mathematical foundation to it at all - it might possibly be completely incidental.

17. ### QuarkHeadRemedial Math StudentValued Senior Member

Messages:
1,622
Ya know, the secret of this trick, like all conjuring tricks, is to confuse the issue with quite unnecessary red-herrings.

The answer is entirely to do with using base 10 arithmetic, or, as mathematicians would call it, "integer operations modulo 9".

Look - choose a number of any number of digits (they need not all be different, either from each other or from zero). Call its residue class mod 9 as [n]. This class designation will not change whatever order these digits are written in - a property of modulo arithmetic. Then obviously, by subtraction you end up with the residue class [0].

To see this, take Dave's example and add the final "stable" set of integers. Then add the result of this sum. Guess what? it is 9, an element of residue class [0]

18. ### phytiRegistered Senior Member

Messages:
356
pik 4 position integer in descending order s=abcd
reverse order r=dcba
s=(1000a+100b+10c+d
r=1000d+100c+10b+a
u=s-r
u=1000(a-d)+100(b-c)+10(c-b)+(d-a)
u=1000x+90y-x
u=f(x,y)
if x=6 and y=2
then
u=6180-6=6174
which cycles to 62

File size:
28.9 KB
Views:
2