login
The digits of a(n) and a(n+1) together can be reordered to form a palindrome; lexicographically least injective sequence of positive integers with this property.
5

%I #20 Jan 02 2023 12:30:49

%S 1,10,100,11,2,12,21,102,20,101,22,3,13,31,103,30,110,33,4,14,41,104,

%T 40,114,24,42,112,23,32,113,34,43,131,35,5,15,51,105,50,115,25,52,121,

%U 26,6,16,61,106,60,116,36,63,136,163,316,361,613,631,1003,111,17,7,27,72,117,37,73,137,71,107

%N The digits of a(n) and a(n+1) together can be reordered to form a palindrome; lexicographically least injective sequence of positive integers with this property.

%C For each n=1,2,3..., choose the smallest positive integer a(n) not occurring earlier such that the digits of a(n) and the preceding term (none for n=1) taken together can form a palindrome, when suitably reordered.

%C This is a variant of the original version, proposed by E. Angelini, based on nonnegative integers (cf. A228407). The two sequences start with only a few terms differing and large segments in common, and one might have expected them to join a common orbit quite early, but they rather diverge more and more.

%C It is conjectured that the sequence is a permutation of the positive integers, i.e., that all numbers will eventually occur. To test this conjecture, one can consider the indices n at which occur the numbers equal to the smallest integer not yet used. If the conjecture is true, this is equivalent to a(m)>a(n) for all m>n; if not, then this list ends at the first missing number. These [n,a(n)] are: [1, 1], [5, 2], [12, 3], [19, 4], [35, 5], [45, 6], [62, 7], [78, 8], [88, 9], [89, 29], [92, 39], [118, 44], [149, 45], [187, 46], [314, 47], [432, 49], [477, 59], [506, 67], [507, 76], [521, 78], [531, 79], [572, 89], [573, 98], [574, 198], [954, 211][955, 222], [956, 233], [1602, 234], [1616, 235], [1623, 237], [1924, 238], [1959, 239], [2508, 258], [2515, 278], [2536, 279], [4046, 289], [4047, 298], [4053, 489], [4054, 498], ...

%C Sequence A228412 is an "arithmetic" variant, where instead of the union of the digits, the sum of terms is considered. Sequence A062932 is a further variant where injectivity is replaced by monotonicity.

%C Sequences A231433 and A231442 are variants where "palindrome" is replaced with "prime".

%H Lars Blomberg, <a href="/A228410/b228410.txt">Table of n, a(n) for n = 1..10000</a>

%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2013-November/011855.html">Re: Two make a palindrome</a>, SeqFan list, Nov 09 2013

%o (PARI) {u=0; a=1; for(n=1,99, u+=1<<a; print1(a","); for(k=1,9e9, bittest(u,k)&&next; d=vecsort(Vec(Str(a,k)),,4); d[2]=="0"&&next; s=!bittest(#d,0); forstep(i=2,#d,2,d[i-1]==d[i]&&next; s&&next(2); s=d[i--]); a=k; break))}

%o (Python)

%o from collections import Counter

%o A228410_list, l, s, b = [1], Counter('1'), 2, set()

%o for _ in range(10**2):

%o ....i = s

%o ....while True:

%o ........if i not in b:

%o ............li, o = Counter(str(i)), 0

%o ............for d in (l+li).values():

%o ................if d % 2:

%o ....................if o > 0:

%o ........................break

%o ....................o += 1

%o ............else:

%o ................A228410_list.append(i)

%o ................l = li

%o ................b.add(i)

%o ................while s in b:

%o ....................b.remove(s)

%o ....................s += 1

%o ................break

%o ........i += 1 # _Chai Wah Wu_, Dec 14 2014

%Y Cf. A228407, A231442, A231433.

%K nonn,base

%O 1,2

%A _M. F. Hasler_, Nov 09 2013