Poor sandwich sequence

Hello SeqFans,
Here is what we call a "poor sandwich": say there is a pair of adjacent integers in S like [1951, 2020]. The sandwich is made of the rightmost digit of a(n), the leftmost digit of a(n+1) and, in between, the absolute difference of those two digits. The pair [1951, 2020] would then produce the sandwich 112. (Why "poor"? Because a "rich" sandwich would insert the sum of the digits instead of their absolute difference – that is 132). Please note that the pair [2020, 1951] would produce the poor sandwich 011 (we keep the leading zero – these are sandwiches after all, not integers!-)
Now we want S to be the lexicographically earliest sequence of distinct positive terms such that the successive sandwiches emerging from S rebuild S – digit after digit:

S = 2, 1, 110, 10, 1101, 11010, 3, 330, 30, 3303, 33030, 4, 440, 40, 4404, 44040, 5, 550, 50, 5505, 55050, 6, 660, 60, 6606, 66060, 7, 770, 70, 7707, 77070, 8, 880, 80, 8808, 88080, 9, 990, 90, 9909, 99090, 11, 101, 1010, 22, 202, 2020, 33, 303, 3030, 44, 404, 4040, 55, 505, 5050, 66, 606, 6060, 77, 707, 7070, 88, 808, 8080, 99, 909, 9090, 112, 114, 220, 116, 332, 118, 442, 1122, 42, 1144,...

The successive "poor sandwiches" are:
211, 101, 011, 011, 101, 033, 303, 033, 033, 303, 044, 404, 044,...

Pairs and sandwiches' check:
2,  1, 110, 10, 1101, 11010,  3, 330, 30, 3303, 33030,  4, 440, 40,
 211 101  011 011   101    033 303  033 033   303    044 404  044

... But I don't know if the sequence S stops at some point.
P.-S.
The "rich sandwich" sequence does stop after 14 terms. Indeed, the "3" inside the 11th term (135) cannot be described by any sandwich:
R = 9, 10, 101, 11, 2,  1, 13, 22, 31, 12, 135, 225, 312, 123, stop.
The successive rich sandwiches are:
    9101 011 121 132 231 121 352 253 121 231  572  583  231, ...
Best,
É.














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