Erase my palindrome (and iterate)


11, 232 and 4554 are palindromes. We decide here that a palindrome cannot have less than 2 digits (3 and 7, for instance, are not considered as palindromes).
Note that some integers contain one or more palindromes: 112 contains the palindromic substring 11 and 24046 contains 404.

We are ready to play now with the hereunder rules.

a) If an integer k contains no palindrome, double k (and iterate);
b) If a palindrome is present in k, first erase the palindrome, then concatenate the remaining digits, then double the result (and iterate).

You will find below more information about the erasing protocol.

Example with 27 (the yellow palindromes are erased):
27, 54, 108, 216, 432, 864, 1728, 3456, 6912, 13824, 27648, 55296, 296, 592, 1184, 84, 168, 336, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, stop.

We see that the iteration starting with 27 stops after 48 steps (and 7 palindrome-erasures). The largest term reached is 65536.

Erasing protocol
1) We do not want any leading zero after an erasure: 1102 becomes 2;
2) If two or more disjoint palindromes are present  in k, erase all of them; 11223424 becomes 3 and 880907 becomes 7.
3) If two or more palindromes overlap, erase the non-overlapping palindromic substrings that will leave the smallest possible integer; 7575 becomes 5, as we erase the palindrome 757, not the palindrome 575 which would leave 7; 1232141881 is interesting, as every digit belongs to at least one palindrome. After a series of trial and error, we can leave 4 (instead of 11, for instance) – 1232141881 vs 1232141881 (we see that the erasures do not overlap, as requested).

We have studied (by hand) the fate of the first 200 integers. None of them enters into a loop, all of them end on 0 or disappear (which is the same).

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, stop.

3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, (which grafts on the above sequence and stops).

5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 655360, 6360, 0.

7, 14, 28, 56, 112, 2, (which grafts on the 1-sequence and stops).

9, 18, 36, 72, 144,  1, (which grafts on the 1-sequence and stops).

11, 0.

13, 26, 52, 104, 208, 416, 832, 1664, 14, (which grafts on the 7-sequence and stops).

15, 30, 60, 120, 240, 480, 960, 1920, 3840, 7680, 15360, 30720, 61440, 610, 1220, 10, (which grafts on the 5-sequence and stops).

17, 34, 68, 136, 272, stop.

19, 38, 76, 152, 304, 608, 1216, 6, (which grafts on the 3-sequence and stops).

21, 42, 84, 168, 336, 6, (which grafts on the 3-sequence and stops).

23, 46, 92, 184, 368, 736, 1472, 2944, 29, 58, 116, 6, (which grafts on the 3-sequence and stops).

25, 50, 100, 1, (which grafts on the 1-sequence and stops).

27, 54, 108, 216, 432, 864, 1728, 3456, 6912, 13824, 27648, 55296, 296, 592, 1184, 84, 168, 336, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, (which grafts on the 1-sequence and stops).
Etc.

Questions
If j exists, what is the smallest integer j entering into a loop?
If k exists, what is the smallest integer k that does not end on 0, does not disappear and does not enter into a loop?

Two sequences we would like to see in the OEIS
— Start the sequence Y with 1 and iterate; when Y stops, extend Y with the smallest integer not present in Y and iterate. I guess we have (using the above table):

Y = 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 655360, 6360, 7, 14, 28, 56, 112, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 9, 18, 36, 72, 144, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 11, 13, 26, 52, 104, 208, 416, 832, 1664, 14, 28, 56, 112, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 15, 30, 60, 120, 240, 480, 960, 1920, 3840, 7680, 15360, 30720, 61440, 610, 1220, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 655360, 6360, 17, 34, 68, 136, 272, 19, 38, 76, 152, 304, 608, 1216, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 21, 42, 84, 168, 336, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 23, 46, 92, 184, 368, 736, 1472, 2944, 29, 58, 116, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 25, 50, 100, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636, 27, 54, 108, 216, 432, 864, 1728, 3456, 6912, 13824, 27648, 55296, 296, 592, 1184, 84, 168, 336, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 636,…

— Look now for the sequences produced by 12, 18 and 24:

12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, …

We say we have a hit, as the digits of 12 appear in the right order (1, then 2) in 12’s sequence;

18, 36, 72, 144, 1, 2, 4, 8, …

We have another hit, as the digits of 18 appear in the right order too (1, then 8) in 18’s sequence;

24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 61, 122, 1, 2, 4, …

One more hit, as the digits of 24 appear in the right order again (2, then 4) in 24’s sequence; etc.

What would Z look like – Z being the sequence of all integers sharing the property of 12, 18 or 24?



Commentaires

Posts les plus consultés de ce blog

A square for three (chess)

Le tripalin se présente

Some strings au cinéma Galeries