login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A371113
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
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, 18, 171, 19, 20, 291, 21, 22, 212, 23, 24, 232, 25, 26, 252, 27, 28, 272, 29, 30, 392, 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
OFFSET
0,3
COMMENTS
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
From M. F. Hasler, Apr 20 2024: (Start)
See A369856 for the inverse permutation.
Conjecture 1: The only fixed points of this permutation are n = 0 and 1.
Conjecture 2: For all k >= 0, a(3k+2) <= R(concatenate(a(3k), a(3k+1), 1)), where R = A004086 = reverse.
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, ...)
(End)
FORMULA
a(3k) = 2k + o(log k) ; a(3k) + 1 <= a(3k+1) <= a(3k) + 2 (conjectured). - M. F. Hasler, Apr 20 2024
EXAMPLE
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.
MATHEMATICA
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]
PROG
(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
(Python)
def A371113(n):
try: return A371113.terms[n]
except AttributeError: A371113.terms = []; A371113.least_unused = 0
except IndexError: pass # just need to compute more terms
while len(T := A371113.terms) <= n:
if len(T)%3 < 2:
T.append(x := A371113.least_unused)
while x+1 in T: x += 1
A371113.least_unused = x+1
else:
for i in range(1, len(suffix := (str(T[-2])+str(T[-1]))[::-1])+1):
if suffix[-i] != '0' and (s := suffix[:-i-1:-1] + suffix
)==s[::-1] and (x := int(suffix[-i:])) not in T: break
else: x = int('1'+suffix); assert x not in T
T.append(x); assert x > A371113.least_unused
return T[n] # M. F. Hasler, Apr 19 2024
CROSSREFS
Cf. A238880 (analog for pairs instead of triples), A369856 (inverse permutation), A004086 (read n backwards).
Sequence in context: A336954 A322467 A342078 * A049296 A220468 A169851
KEYWORD
nonn,base
AUTHOR
STATUS
approved