login
The sequence is a succession of triples of nonnegative integers. In each triple, the digits form a palindromic pattern. The sequence starts with a(0)=0 and is always extended with the smallest available integer not yet present in the sequence.
4

%I #79 Apr 22 2024 19:43:13

%S 0,1,10,2,3,32,4,5,54,6,7,76,8,9,98,11,12,111,13,14,131,15,16,151,17,

%T 18,171,19,20,291,21,22,212,23,24,232,25,26,252,27,28,272,29,30,392,

%U 31,33,313,34,35,343,36,37,363,38,39,383,40,41,404,42,43,424,44,45,444,46,47,464,48,49,484,50,51,505

%N The sequence is a succession of triples of nonnegative integers. In each triple, the digits form a palindromic pattern. The sequence starts with a(0)=0 and is always extended with the smallest available integer not yet present in the sequence.

%C The sequence is a permutation of the nonnegative integers: there is no constraint on terms a(3k) and a(3k+1), which are always the smallest nonnegative integers that did not occur earlier. Therefore each nonnegative integer will occur exactly once. - _M. F. Hasler_, Apr 18 2024

%C From _M. F. Hasler_, Apr 20 2024: (Start)

%C See A369856 for the inverse permutation.

%C Conjecture 1: The only fixed points of this permutation are n = 0 and 1.

%C Conjecture 2: For all k >= 0, a(3k+2) <= R(concatenate(a(3k), a(3k+1), 1)), where R = A004086 = reverse.

%C Conjecture 3: For all k >= 0, a(3k+1) - a(3k) = 1 or 2. (Verified up to k = 3333. a(3k+1) - a(3k) = 2 for k = 15, 36, 62, 81, 110, 129, 138, 163, 182, ...)

%C (End)

%F a(3k) = 2k + o(log k) ; a(3k) + 1 <= a(3k+1) <= a(3k) + 2 (conjectured). - _M. F. Hasler_, Apr 20 2024

%e Triples begin (0,1,10), (2,3,32), (4,5,54), (6,7,76), (8,9,98), ... where the palindromic pattern is clearly visible in each triple.

%t a[0]=0;a[n_]:=a[n]=(k=1;While[MemberQ[Array[a,n-1],k]|| If[Mod[n,3]==2, !PalindromeQ[Flatten[IntegerDigits/@Join[{a[n-2]},{a[n-1]},{k}]]]],k++];k); Array[a,100,0]

%o (PARI) A371113_upto(N)={my(L, U=[-1], F=fromdigits); vector(N, n, [L, N]=[N, if(n%3, U[1]+1, L=eval(Vec(Str(L,N))); N=0; for(k=1, #L, L[k] && Vecrev(n=concat(L, Vecrev(L,k)))==n && !setsearch(U, n=F(Vecrev(L,k))) && n>U[1] && [N=n; break]); if(!N, L=Vecrev(L,-1-#L); until(!setsearch(U, N=F(L))&& N>U[1], L[1]++)); N)]; U=setunion(U,[N]); while(#U>1 && U[1]+1==U[2], U=U[^1]); N)} \\ _M. F. Hasler_, Apr 19 2024

%o (Python)

%o def A371113(n):

%o try: return A371113.terms[n]

%o except AttributeError: A371113.terms = []; A371113.least_unused = 0

%o except IndexError: pass # just need to compute more terms

%o while len(T := A371113.terms) <= n:

%o if len(T)%3 < 2:

%o T.append(x := A371113.least_unused)

%o while x+1 in T: x += 1

%o A371113.least_unused = x+1

%o else:

%o for i in range(1,len(suffix := (str(T[-2])+str(T[-1]))[::-1])+1):

%o if suffix[-i] != '0' and (s := suffix[:-i-1:-1] + suffix

%o )==s[::-1] and (x := int(suffix[-i:])) not in T: break

%o else: x = int('1'+suffix); assert x not in T

%o T.append(x); assert x > A371113.least_unused

%o return T[n] # _M. F. Hasler_, Apr 19 2024

%Y Cf. A238880 (analog for pairs instead of triples), A369856 (inverse permutation), A004086 (read n backwards).

%K nonn,base

%O 0,3

%A _Eric Angelini_ and _Giorgos Kalogeropoulos_, Apr 09 2024