Tuesday, 2 August 2022

Erase or Triple Protocol

There's always something new to discover under the mathematical sun and today I encountered an interesting protocol that can be applied to numbers. It works as follows:

The "Erase or triple" protocol describes how to transform an integer \(K\) into an integer \(L\): if \(K\) has 2 or more identical digits, erase them to get \(L\) (1201331 becomes 20); if \(K\) has no duplicate digits, triple \(K\) to get \(L\) (20 becomes 60). Some integers disappear immediately (like 11, 2002 or 1919188), other enter into a loop if you apply this protocol to the successive results. Link.

My diurnal age today was 26784, a number that is a member of OEIS A300150: "erase or triple": list of the successive integers that produce the next "altitude" record. The initial numbers and their associated "altitude" records are as follows (the numbers are shown first in bold and records second - permalink):

(1, 17010), (10, 65610), (23, 121743), (176, 1154736), (1760, 1283040), (2183, 1591407), (2640, 5773680), (23976, 5826168), (24056, 5845608), (26784, 6508512), (29087, 7068141), (29701, 7217343), (30715, 7463745), (31456, 7643808), (32145, 7811235)

Thus the numbers associated with these maximum values are:

1  10  23  176  1760  2183  2640  23976  24056  26784  29087  29701  30715  31456  32145  

 Let's take 26784 as an example. It's trajectory is as follows:

26784, 80352, 241056, 723168, 2169504, 6508512, 60812, 182436, 547308, 1641924, 692, 2076, 6228, 68, 204, 612, 1836, 5508, 8, 24, 72, 216, 648, 1944, 19, 57, 171, 7, 21, 63, 189, 567, 1701, 70, 210, 630, 1890, 5670, 17010, 7

Note that trajectory enters a loop once 7 is reached for the second time. The trajectory has a length of 39 steps. It's graph is shown in Figure 1:


Figure 1: permalink

176, from the above list of record breakers, is an example of a number that eventually reaches 0. It's trajectory is as follows:

176, 528, 1584, 4752, 14256, 42768, 128304, 384912, 1154736, 54736, 164208, 492624, 96, 288, 2, 6, 18, 54, 162, 486, 1458, 4374, 37, 111, 0

The graph of its trajectory is shown in Figure 2 and consists of 25 steps: 


Figure 2: permalink

23, from the above list of record breakers, is an example of a number that ends in an 89 loop. It's trajectory of length 21 steps is as follows:

23, 69, 207, 621, 1863, 5589, 89, 267, 801, 2403, 7209, 21627, 167, 501, 1503, 4509, 13527, 40581, 121743, 2743, 8229, 89

The graph of its trajectory is shown in Figure 3:


Figure 3: permalink

29701, from the above list of record breakers, is an example of a number that ends in a 5 loop. It's trajectory, of length 22 steps, is as follows:

29701, 89103, 267309, 801927, 2405781, 7217343, 214, 642, 1926, 5778, 58, 174, 522, 5, 15, 45, 135, 405, 1215, 25, 75, 225, 5

The graph of its trajectory is shown in Figure 4:


Figure 4: permalink

For any number, there are only four possible end results for its trajectory: either it reaches 0 or it enters a 5, 7 or 89 loop. Returning to OEIS A300150: "erase or triple": list of the successive integers that produce the next "altitude" record. The sequence is finite and has 628 terms, with a(628) = 3291768054 (pandigital); a(628) reaches the maximum possible "altitude" 29625912486.

When dealing with trajectories, we are interested in the length of the trajectories as well as the maxima and so a reasonable question to ask is what numbers produce trajectories of record length? It turns out that these are the records up to 40,000 with numbers first in bold and trajectory lengths following (permalink):
[(1, 29), (16, 32), (26, 35), (56, 37), (134, 39), (218, 41), (241, 45), (871, 46), (8059, 47), (14957, 48)]

Thus the numbers associated with the record trajectory lengths are:

1  16  26  56  134  218   241  871   8059  14957 

 The trajectory of 14957, with a trajectory length of 48, is as follows:

14957, 44871, 871, 2613, 7839, 23517, 70551, 701, 2103, 6309, 18927, 56781, 170343, 1704, 5112, 52, 156, 468, 1404, 10, 30, 90, 270, 810, 2430, 7290, 21870, 65610, 510, 1530, 4590, 13770, 130, 390, 1170, 70, 210, 630, 1890, 5670, 17010, 7, 21, 63, 189, 567, 1701, 70

This 70 loop is actually a part of the 7 loop as can be seen below:

7, 21, 63, 189, 567, 1701, 70, 210, 630, 1890, 5670, 17010, 7 

The graph of its trajectory is shown in Figure 5:


Figure 5: permalink

This "erase or triple" protocol could be generalised so if the digits of a number satisfy a certain criterion then they are erased to form a new number or, if the criterion is not met, the number is modified in some way. For example, suppose the number contains prime digits (2, 3, 5 or 7). If it does, then these digits are erased. If the number does not contain any prime digits, then the number is squared and 1 is added.

Let's use 14857 as a test number. It contains the prime digits 5 and 7 so these are erased to leave 148. This number contains no prime digits so it becomes 148 x 148 + 1 = 21905. We erase the 2 and the 5 to get 190 which becomes 190 x 190 + 1 = 36101 and so on. I could continue but the trajectory under this new protocol is best dealt with by creating an appropriate algorithm (permalink).

Using the algorithm, the trajectory turns out to have a length of 7 and is:

14857, 148, 21905, 190, 36101, 6101, 37222202, 0

Once 37222202 is reached and all the prime digits are erased, we are left with 0. This seems to be the fate of many numbers but not all. For example, while 6, 66 and 666 all end in 0, 6666 increases rapidly without bound. It might be better to double the number and add 1 rather than squaring it and adding 1. However, I'm digressing. This new protocol and variations thereof could serve as the basis for a future post but that's enough for this post.

In closing, I'll just observe that protocols like these, where we are manipulating the digits of the number in some way, fall into the realm of recreational mathematics rather than serious mathematics. Not only are they specific to the number base 10 but they also ignore, in the first step, the place value of the digits and acknowledge only the face value. Nonetheless, it's fun to explore the resultant trajectories when the different protocols are applied.

No comments:

Post a Comment