### Does this iteration end? (Sum and erase)

Does this iteration end?

The procedure is easy to understand; we take any integer N (for example N = 1124), make the sum S of its digits (S = 8 here) and concatenate S at the end of N (we get 11248).

We iterate from there until the leftmost digit d of N appears in S: we then erase all d’s of the last concatenation – and start from there a new iteration.

Example:

1124

11248

1124816 (hit: the digit d = 1 appears in S = 16)

2486 (we have erased all 1s of the last concatenation)

248620 (hit again: the digit d = 2 appears in S = 20)

4860 (we have erased all 2s of the last concatenation)

486018

48601827

4860182736

Wait, what happens if we bump into a leading zero? Let’s go on with our example to see the rule:

486018273645 (hit: the digit d = 4 appears in S = 45)

8601827365

860182736546

86018273654656

8601827365465667

860182736546566780 (hit: the digit d = 8 appears in S = 80)

601273654656670

60127365465667064 (hit: the digit d = 6 appears in S = 64)

01273545704 (we have now a leading zero)

Rule: we leave the above string as it is and iterate from there, as we’ve done so far (the leading zero will appear at some point in some S)

0127354570438

012735457043849

01273545704384962

0127354570438496270 (hit: the digit d = 0 appears in S = 70)

1273545743849627

Etc.

You’ve certainly noticed that the starting N of the above example (N = 1124) is nothing else but the beginning of the sequence starting with N = 11.

As all the sequences that start with 0 < N < 11 end almost immediately (N = 10, 101, 0), we could ask ourselves if the sequence produced by N = 11 ends at some point? Grows forever? Loops? Vanishes?

Forgive, as always, the typos left in this message/computations; I hope the idea is clear.

Best,

É.

__________

Update, a couple of hours after this was sent to Math-Fun:

[Michael Branicky]:

> Eric, I get it ending in the empty string after 1399142 steps

[Me]:

> Waooooow, Michael! > I'm k.o.! > Do you still have the longest string of yr computation? > And what about another start (like N = 12) > (no, just kidding!-) > Best, > É.

[Michael]:

> Eric,

> starting at "11", the longest string encountered: 444444414144444454144444145454455155154545515454564756517555545657676664465677675961617616416561527541551562575592651853254255356658359962263264365667368971272273374676377982812823836853869892911922935952968991101010121016 (length 222)

>"12" ends at step 384831

>Cheers,

>Michael

[Hans Havermann]:

>> [Eric asks]: "Do you still have the longest string of yr computation?"

>  I guess we can both check this against Michael's response. :) At step 1011800 we have the length-222 string: 444444414144444454144444145454455155154545515454564756517555545657676664465677675961617616416561527541551562575592651853254255356658359962263264365667368971272273374676377982812823836853869892911922935952968991101010121016

[Hans to Eric]:

"At step 1011800 we have the length-222 string"

I didn't know we were starting with "11" (I started with "1124"). So it is at step 1011802. That explains my difference of 2 for the total number of steps before reaching the empty string

[Hans, exploring this idea further]:

The smallest number that does not disappear is 25.

step # 0 = 25
step # 1 = 257
step # 2 = 25714
step # 3 = 2571419 step # 4 = 5714199
step # 5 = 571419936 step # 6 = 714199364
step # 7 = 71419936444 step # 8 = 7141993644452
step # 9 = 714199364445259
step #10 = 141993644452593 ... step #209860 = 86690889849611111412012312914114719139152160167
step #209861 = 669094961111141201231291411471913915216016711 ... step #776829 = 7577447547597444393374947933393373393543339337317383413493533735358374388474184314394554694885851481494511518532542553566583599622632643656673689712722733746763779828128238368538698929119229359529689911010101210161024103110361046
... step #793652 = 86688909849611111412012312914114719139152160167
step #793653 = 669094961111141201231291411471913915216016711

The string at #209861 repeats at #793653 (but from a different precursor), creating a loop of length 583792. #776829 gives the maximum, which will of course repeat at #776829+583792n for positive n.

[Hans again, a couple of hours later on Math-Fun]:

http://cinquantesignes.blogspot.com/2022/07/does-this-iteration-end-sum-and-erase.html Eric's procedure appears to mostly vanish small starting integer strings but there are cycles: 25, 31, 63, 67, 69, 77, 92, 96, 99, 105, 109, 116, 133, 138, 148, 152, 161, 162, 163, 168, 174, 194, 197, 198, 206, ... run into them, or rather into it, since it's always the same length-583792 cycle, call it c3374 after its shortest string. Can anyone find any other cycle?

_______________________________

... Beautiful discovery, Hans, many thanks!

See hereunder how an integer like 282 vanishes:

#### step #0 = 282step #1 = 28212  (hit: the digit d = 2 appears in S = 12)step #2 = 81step #3 = 819step #4 = 81918 (hit: the digit d = 8 appears in S = 18)step #5 = 191step #6 = 19111(hit: the digit d = 1 appears in S = 11)step #7 = 9step #8 = 99 (hit: the digit d = 9 appears in S = 9)step #9 = .. (vanishes)

The same 9-step vanishing would happen with 228, of course – but not with 822...

(to be continued?)

___________________________________

Yes! Hans wrote another couple of hours later:

[Hans]:

"... it's always the same length-583792 cycle, call it c3374 after its shortest string. Can anyone find any other cycle?" I didn't think that there would be any short cycles, but I did find one: length-49, c5464644657500000011711019071641751. Here's how it goes:

step #0 = 5464644657500000011711019071641751 step #1 = 5464644657500000011711019071641751109 step #2 = 5464644657500000011711019071641751109119 step #3 = 5464644657500000011711019071641751109119130 step #4 = 5464644657500000011711019071641751109119130134 step #5 = 5464644657500000011711019071641751109119130134142 step #6 = 5464644657500000011711019071641751109119130134142149 step #7 = 5464644657500000011711019071641751109119130134142149163 step #8 = 5464644657500000011711019071641751109119130134142149163173 step #9 = 5464644657500000011711019071641751109119130134142149163173184 step #10 = 5464644657500000011711019071641751109119130134142149163173184197 step #11 = 5464644657500000011711019071641751109119130134142149163173184197214 step #12 = 5464644657500000011711019071641751109119130134142149163173184197214221 step #13 = 5464644657500000011711019071641751109119130134142149163173184197214221226 step #14 = 5464644657500000011711019071641751109119130134142149163173184197214221226236 step #15 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247 step #16 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260 step #17 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260268 step #18 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260268284 step #19 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260268284298 step #20 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260268284298317 step #21 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260268284298317328 step #22 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260268284298317328341 step #23 = 5464644657500000011711019071641751109119130134142149163173184197214221226236247260268284298317328341349 step #24 = 46464467000000117110190716417110911913013414214916317318419721422122623624726026828429831732834134936 step #25 = 66670000001171101907161711091191301312191631731819721221226236272602682829831732831393635 step #26 = 700000011711019071171109119130131219131731819721221222327202828298317328313933530 step #27 = 700000011711019071171109119130131219131731819721221222327202828298317328313933530249 step #28 = 700000011711019071171109119130131219131731819721221222327202828298317328313933530249264 step #29 = 000000111101901111091191301312191313181921221222322028282983132831393353024926426 step #30 = 000000111101901111091191301312191313181921221222322028282983132831393353024926426228 step #31 = 11111911119119131312191313181921221222322282829831328313933532492642622824 step #32 = 11111911119119131312191313181921221222322282829831328313933532492642622824246 step #33 = 11111911119119131312191313181921221222322282829831328313933532492642622824246258 step #34 = 11111911119119131312191313181921221222322282829831328313933532492642622824246258273 step #35 = 11111911119119131312191313181921221222322282829831328313933532492642622824246258273285 step #36 = 11111911119119131312191313181921221222322282829831328313933532492642622824246258273285300 step #37 = 11111911119119131312191313181921221222322282829831328313933532492642622824246258273285300303 step #38 = 11111911119119131312191313181921221222322282829831328313933532492642622824246258273285300303309 step #39 = 99933293389222222322282829833283393353249264262282424625827328530030330932 step #40 = 99933293389222222322282829833283393353249264262282424625827328530030330932303 step #41 = 3323382222223222828283328333353242642622824246258273285300303303230330 step #42 = 282222222228282828524264262282424625827285000020021 step #43 = 282222222228282828524264262282424625827285000020021171 step #44 = 282222222228282828524264262282424625827285000020021171180 step #45 = 282222222228282828524264262282424625827285000020021171180189 step #46 = 8888854646844658785000000117118018907 step #47 = 8888854646844658785000000117118018907164 step #48 = 8888854646844658785000000117118018907164175 step #49 = 5464644657500000011711019071641751
___________________________________________