Monday, August 01, 2022

Sum & erase (integer version)

One of the drawbacks of Éric Angelini's sum-and-erase is that we are dealing with number strings, not integers. This is because we allow leading zeros. There's an easy and obvious fix: Don't allow leading zeros! Everything else is the same but, if the erasure of all instances of a digit (1-9) that is contained in the sum-of-digits moves one or more zeros to the leading (left) edge then those zeros are erased as well. Now the only number that is allowed to start with zero is zero itself. And 0 by itself disappears because it is the left-most digit of 0 and the sum-of-digits is 0. And although total erasure (the empty string "" in Éric's version) happens here as well, we can define it to be zero so as to keep our sequencing in the integer realm. Conveniently in Mathematica, FromDigits[{}] == FromDigits[{0}] == 0.

 0 => "" = 0
 1 =>
 "" = 0
 2 =>
 "" = 0
 3 =>
 "" = 0
 4 =>
 "" = 0
 5 =>
 "" = 0
 6 =>
 "" = 0
 7 =>
 "" = 0
 8 =>
 "" = 0
 9 =>
 "" = 0
100..00 => 0
 => "" = 0

Summarizing the procedure:

0. Start with a base-ten nonnegative integer.
1. Total the number's digits and concatenate this sum to the right of the number.
2. If the first digit in our number is one of the digits in our sum, delete every instance of it.
3. If (after deletion) there now appear leading zeros in our number, delete these as well.
4. If all digits or even all non-zero digits have been deleted, the subsequent term is zero.
5. Otherwise, the subsequent term is the concatenation of the remaining digits.
6. To generate a sequence of terms, iterate. Most starts eventually end up at zero.

In Éric's procedure, I had found (in addition to the fixed-point c0) six cycles. In this integer version, I have [index.  name = c&start-string  (cycle length)  {smallest precursor}]:

0.  c0  (1)  {0}

1.  c86  (80858)  {16}

2.  c30323322046333587  (1634)  {5916}

3.  c48822444886224973  (29)  {23675}:

 0 48822444886224973
 1 4882244488622497385
 2 488224448862249738598
 3 488224448862249738598115
 4 488224448862249738598115122
 5 488224448862249738598115122127
 6 488224448862249738598115122127137
 7 882288622973859811512212713718
 8 882288622973859811512212713718137
 9 2262297359115122127137113714
10 226229735911512212713711371497
11 226229735911512212713711371497113
12 226229735911512212713711371497113118
13 6973591151171371137149711311818
14 6973591151171371137149711311818123
15 6973591151171371137149711311818123129
16 6973591151171371137149711311818123129141
17 6973591151171371137149711311818123129141147
18 6973591151171371137149711311818123129141147159
19 6973591151171371137149711311818123129141147159174
20 97359115117137113714971131181812312914114715917418
21 73511511713711371471131181812312141147151741818
22 73511511713711371471131181812312141147151741818153
23 73511511713711371471131181812312141147151741818153162
24 351151113113141131181812312141141514181815316211
25 351151113113141131181812312141141514181815316211124
26 51151111114111181812121411415141818151621112411
27 111111114111181812121411411418181162111241111
28 11111111411118181212141141141818116211124111197
29 48822444886224973

4.  c77078088077807837313303137333430853003033013  (43)  {83123}

5.  c886054637  (140)  {256311}

6.  c5869099118496111114109711  (85)  {346715}

Also six cycles (so far), in order of smallest precursor. I have a distance-to-cycle chart. For positive terms it is the number of steps needed to get to zero. Negative terms are for starts that will reach some other cycle. Terms that are 0 are for integers that are part of a cycle.

No comments:

Post a Comment