login
The prime sandwiches sequence (see Comments lines for definition).
1

%I #10 Sep 06 2020 04:58:52

%S 1,22,2,3,225,33,7,25,11,331,37,71,72,5,19,112,3312,9,373,17,13,77,24,

%T 15,54,31,94,712,53,32,59,99,6,133,67,177,113,73,777,92,4,8,315,89,

%U 549,731,10,194,103,7210,75,310,93,21,135,91,27,991,316,61,371,313,96,714,917,151,131,57

%N The prime sandwiches sequence (see Comments lines for definition).

%C Imagine we would have a pair of adjacent integers in the sequence like [1951, 2020]. The sandwich would then be made of the rightmost digit of a(n), the leftmost digit of a(n+1) and, in between, the smallest prime p not yet inserted in a sandwich. The pair [1951, 2020] would then produce the sandwich 1p2. Please note that the pair [2020, 1951] would produce the genuine sandwich 0p1 (we keep the leading zero: these are sandwiches after all, not integers).

%C Now we want the sequence to be the lexicographically earliest sequence of distinct positive terms such that the successive sandwiches emerging from the sequence rebuild it, digit after digit.

%H Carole Dubois, <a href="/A336895/b336895.txt">Table of n, a(n) for n = 1..1964</a>

%e The first successive sandwiches are: 122, 232, 253, 372, 5113, 3137,...

%e The 1st one (122) is visible between a(1) = 1 and a(2) = 22 (insert 2).

%e The 2nd one (232) is visible between a(2) = 22 and a(3) = 2 (insert 3).

%e The 3rd one (253) is visible between a(3) = 2 and a(4) = 3 (insert 5).

%e The 4th one (372) is visible between a(4) = 3 and a(5) = 225 (insert 7).

%e The 5th one (5113) is visible between a(5) = 225 and a(6) = 33 (insert 11); etc.

%e The successive sandwiches rebuild, digit by digit, the starting sequence.

%Y Cf. A336894 (empty sandwiches), A335600 (poor sandwiches).

%K base,nonn

%O 1,2

%A _Carole Dubois_ and _Eric Angelini_, Aug 07 2020