Re: MiniChallenge: Zip Code Message #18 Posted by Thomas Klemm on 27 Sept 2010, 2:59 p.m., in response to message #1 by Thomas Klemm
Quote:
The following challenge is based on an arithmetic problem I found in a mathematics book for elementary school.
Quote:
I will add my solution for the HP15C here within a couple of days.
Initialization:
10 STO 0
001  42,21,11 LBL A 022  30 
002  32 0 GSB 0 023  9 9
003  32 0 GSB 0 024  0 0
004  32 0 GSB 0 025  20 ×
005  43,30, 7 TEST 7 026  34 x<>y
006  34 x<>y 027  43 33 R^
007  33 Rv 028  30 
008  43,30, 7 TEST 7 029  9 9
009  34 x<>y 030  9 9
010  33 Rv 031  9 9
011  43,30, 7 TEST 7 032  20 ×
012  34 x<>y 033  40 +
013  43 33 R^ 034  43 32 RTN
014  43,30, 7 TEST 7 035  42,21, 0 LBL 0
015  34 x<>y 036  45,10, 0 RCL ÷ 0
016  43 33 R^ 037  43 44 INT
017  43,30, 7 TEST 7 038  43 36 LASTx
018  34 x<>y 039  42 44 FRAC
019  33 Rv 040  45,20, 0 RCL × 0
020  43,30, 7 TEST 7 041  34 x<>y
021  34 x<>y 042  43 32 RTN
Quote:
What is the behavior if you iterate this? Make a speculation.
Most numbers will end up with 6174. Only numbers composed of the same digit will end up with 0.
Quote:
Try to proof your assumption.
My observation was the same as described in Mysterious number 6174. (cf. "Which way to 6174?")
So I guess I don't have to repeat that proof here. However I didn't ignore possible duplicates of the 55 numbers that remain after the first iteration.
Quote:
Can your calculator be of any help?
Here's a small program that produces the 55 numbers left after the first iteration:
Initialization:
9 STO 1
EEX 3 / STO 2
043  42,21,12 LBL B 055  42, 6, 2 ISG 2
044  45 1 RCL 1 056  43 32 RTN
045  9 9 057  42, 5, 1 DSE 1
046  9 9 058  43 20 x=0
047  9 9 059  43 32 RTN
048  20 × 060  45 1 RCL 1
049  45 2 RCL 2 061  26 EEX
050  43 44 INT 062  3 3
051  9 9 063  10 ÷
052  0 0 064  44 2 STO 2
053  20 × 065  33 Rv
054  40 + 066  43 32 RTN
Now you can switch between the two programs A and B:
B: 8991
A: 8082
A: 8532
A: 6174
B: 9081
A: 9621
A: 8352
A: 6174
(...)
B: 0
A: 0
The data was then used to create this graph.
There's a direct proof in the same article as well. (cf. "Only 6174?")
Again the HP15C can be used to solve the system of linear equations:
 1 0 1 1   a   10 
     
 1 1 1 0   b   9 
    =  
 0 1 1 1   c   1 
     
 1 1 0 1   d   0 
The solution is: [ a b c d ] = [ 7 6 4 1 ]
I must admit that I wasn't aware of Kaprekar's constant. I just saw this arithmetic problem in that book which made me wonder why. So thanks a lot to Paul Dale for pointing this out.
I know it wasn't a hard problem but still an occasion to use your best loved machines. Nevertheless I hope you enjoyed the contest.
Cheers and thanks for your contributions
Thomas
Quote:
PS: And where will all this lead us?
6174 Sörenberg
Edited: 27 Sept 2010, 3:43 p.m.
