Sunday 29 January 2023

Iteration: Reverse and Add Sum of Digits

My previous post, titled Iteration: Reverse and Subtract Maximum Digit, encouraged me to look at some variants on this theme. I discovered that Reverse and Add Sum of Digits is interesting. In the range up to 100,000, this iteration always produces a loop. The trajectory of maximum length is achieved by 84761 with a length of 126. Here is the trajectory:

84761, 16774, 47786, 68806, 60914, 41926, 62936, 63952, 25961, 16975, 57989, 99013, 31121, 12121, 12128, 82135, 53147, 74155, 55169, 96181, 18194, 49204, 40313, 31315, 51326, 62332, 23342, 24346, 64361, 16366, 66383, 38392, 29408, 80515, 51527, 72535, 53549, 94561, 16574, 47584, 48602, 20704, 40715, 51721, 12731, 13735, 53750, 5755, 5597, 7981, 1922, 2305, 5042, 2416, 6155, 5533, 3371, 1747, 7490, 967, 791, 214, 419, 928, 848, 868, 890, 115, 518, 829, 947, 769, 989, 1015, 5108, 8029, 9227, 7249, 9449, 9475, 5774, 4798, 9002, 2020, 206, 610, 23, 37, 83, 49, 107, 709, 923, 343, 353, 364, 476, 691, 212, 217, 722, 238, 845, 565, 581, 199, 1010, 103, 305, 511, 122, 226, 632, 247, 755, 574, 491, 208, 812, 229, 935, 556, 671, 190, 101, 103

Figure 1 shows a graph of the trajectory.


Figure 1: permalink

Figure 2 shows the same graph by with a logarithmic scale for the y axis.


Figure 2: permalink

Figure 3 shows a plot of the trajectory lengths for the first 100,000 numbers.


Figure 3: permalink

The average trajectory length is a little of over 43. As the numbers get bigger, it's not surprising that the trajectory lengths grow larger. For example, take the set of numbers corresponding to the dates in 2023 (see Turning Dates Into Numbers). For this set of numbers, the average trajectory length is a little over 72 and the record is achieved by 20230518 (corresponding to 18th May 2023) with a trajectory length of 162:

20230518, 81503223, 32230542, 24503244, 44230566, 66503274, 47230599, 99503313, 31330632, 23603334, 43330656, 65603364, 46330689, 98603403, 30430722, 22703424, 42430746, 64703454, 45430779, 97703493, 39430821, 12803523, 32530845, 54803553, 35530878, 87803592, 29530920, 2903622, 2263116, 6113643, 3463140, 413664, 466338, 833694, 496371, 173724, 427395, 593754, 457428, 824784, 487461, 164814, 418485, 584844, 448518, 815874, 478551, 155904, 409575, 575934, 439608, 806964, 469641, 146994, 499674, 477033, 330798, 897063, 360831, 138084, 480855, 558114, 411879, 978144, 441912, 219165, 561936, 639195, 591969, 969234, 433002, 200346, 643017, 710367, 763041, 140388, 883065, 560418, 814089, 980448, 844122, 221469, 964146, 641499, 994179, 971538, 835212, 212559, 955236, 632589, 985269, 962628, 826302, 203649, 946326, 623679, 976359, 953718, 817392, 293748, 847425, 524778, 877458, 854817, 718491, 194847, 748524, 425877, 778557, 755916, 619590, 95946, 64992, 29976, 68025, 52107, 70140, 4119, 9129, 9240, 444, 456, 669, 987, 813, 330, 39, 105, 507, 717, 732, 249, 957, 780, 102, 204, 408, 816, 633, 348, 858, 879, 1002, 2004, 4008, 8016, 6123, 3228, 8238, 8349, 9462, 2670, 777, 798, 921, 141, 147, 753, 372, 285, 597, 816

Figure 4 shows a graph of this trajectory:


Figure 4: permalink

Figure 5 shows the same trajectory but uses a logarithmic scale for the y axis:


Figure 5: permalink

I suspect that a loop is eventually reached for any number, no matter how large. However, I can't prove this but a proof may be possible. This iteration that I've just examined is just another of many possible iterations and I may investigate others at a future date.

No comments:

Post a Comment