This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A228407 #131 Aug 17 2025 03:51:55 %S A228407 0,11,1,10,100,12,2,20,101,22,3,13,31,103,30,110,33,4,14,41,104,40, %T A228407 114,24,42,112,21,102,120,201,210,1000,105,15,5,25,52,115,35,53,113, %U A228407 23,32,121,26,6,16,61,106,60,116,36,63,131,34,43,134,143,314 %N A228407 The digits of a(n) and a(n+1) together can be reordered to form a palindromic integer; the lexicographically earliest injective sequence of nonnegative integers with this property. %C A228407 For each n=0,1,2,3..., choose the smallest nonnegative integer a(n) not occurring earlier such that the digits of a(n) and a(n-1) (none for n=0) taken together can form a palindrome when suitably reordered. %C A228407 It is conjectured that the sequence is a permutation of the nonnegative integers (motivating the choice of offset 0), i.e., that all numbers will eventually occur. (The conjecture is true - see below. - _N. J. A. Sloane_, Nov 12 2013) %C A228407 To test this conjecture, consider the indices n where the smallest integers not yet used occur. 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: [0, 0], [2, 1], [6, 2], [10, 3], [17, 4], [34, 5], [45, 6], [65, 7], [81, 8], [118, 9], [119, 29], [122, 39], [145, 44], [152, 45], [197, 46], [230, 47], [271, 48], [362, 49], [533, 57], [740, 58], [754, 68], [816, 69], [855, 89], [856, 98], [857, 198], [1011, 211], [1012, 222], [1110, 224], [1232, 225], [1385, 234], [1406, 236], [1413, 237], [1767, 238], [1921, 239], [2555, 257], [2590, 259], [2597, 269], [4354, 279], [4355, 297], [4361, 379], [4362, 397], [4368, 479], [4369, 497],... %C A228407 See A228410 for the variant considering only positive integers, and comments about the differences. %C A228407 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 A228407 From _N. J. A. Sloane_, Nov 13 2013: (Start) %C A228407 Theorem. In any base b >= 2, Eric Angelini's "palindrome" sequence (A228407 in base 10, A230891 and A230892 in base 2) contains every number n >= 0 and is therefore a permutation of the numbers n >= 0. %C A228407 Proof. Fix the base b >= 2. Classify numbers n into 2^b classes according to the parity of the numbers of 0's, 1's, ..., b-1's they contain. %C A228407 Construct a graph G with these 2^b classes as nodes, with two nodes joined by an edge iff they are at Hamming distance 0 or 1 apart. This is the b-dimensional cube graph with a loop at each node. %C A228407 Let S = a(0), a(1), ... denote Angelini's palindromic sequence in base b. A set of digits can be arranged to form a palindrome iff there is an even number of copies of every digit or exactly one of the digits occurs an odd number of times. %C A228407 At step n, write a(n) on the node of G corresponding to its parity class. The previous remark implies that the successive a(i) will trace out an infinite path in the graph. %C A228407 At least one node must be visited infinitely often. %C A228407 The rule for constructing the sequence implies that each node adjacent to a node that is visited infinitely often must also be visited infinitely often. Since G is connected, every node is visited infinitely often. Therefore every number must appear in the sequence, for if a number never appeared, the node corresponding to its parity class would only be visited finitely many times. QED. %C A228407 Thanks to _Rob Arthan_ for comments on the original version of this proof. (End) %C A228407 From _Robert G. Wilson v_, Dec 31 2013: (Start) %C A228407 Records: 0, 11, 100, 101, 103, 110, 114, 120, 201, 210, 1000, 1003, 1007, 1008, 1020, 1029, 1030, 1040, 1047, 1048, 1082, 1208, 1280, 1802, 1820, 2018, 2081, 2108, 2180, 2801, 2810, 8012, 8021, 8102, 8120, 8201, 8210, 10002, 10004, 10007, 10020, 10060, 10080, 10081, 10100, 10105, 10113, 10304, ... [See A377925, A377926. - _N. J. A. Sloane_, Dec 14 2024] %C A228407 Last occurrence: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 29, 39, 44, 45, 46, 47, 48, 49, 57, 58, 68, 69, 89, 98, 198, 211, 222, 224, 225, 234, 236, 237, 238, 239, 257, 259, 269, 279, 297, 379, 397, 479, 497, 589, ... ; %C A228407 Index of last occurrence: 0, 2, 6, 10, 17, 34, 45, 65, 81, 118, 119, 122, 145, 152, 197, 230, 271, 362, 533, 740, 754, 816, 855, 856, 857, 1011, 1012, 1110, 1232, 1385, 1406, 1413, 1767, 1921, 2555, 2590, 2597, 4354, 4355, 4361, 4362, 4368, 4369, ... . (End) %H A228407 Chai Wah Wu, <a href="/A228407/b228407.txt">Table of n, a(n) for n = 0..30000</a> (first 5354 terms from Robert G. Wilson v, next 4646 terms from Lars Blomberg) %H A228407 Rob Arthan, in reply to E. Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2013-November/011861.html">Re: Two make a palindrome</a>, SeqFan list, Nov 09 2013 %e A228407 The second term cannot be "1", because a palindrome cannot be formed from the digits in "01". The second term cannot be "10" because "010", though a palindrome, is not a palindromic integer. However "11" is permissible because "101" is a palindrome. Thus the second term is 11. %e A228407 The third term can be 1 because 111 is a palindrome. %t A228407 a[0] = 0; a[n_] := a[n] = Block[{k = 1, idm = IntegerDigits@ a[n - 1]}, Label[ start]; While[ MemberQ[ a@# & /@ Range[n - 1], k], k++]; While[ idk = IntegerDigits @k; Select[ Permutations[ Join[idm, idk]], #[[1]] != 0 && # == Reverse@# &] == {}, k++; Goto[start]]; k]; Array[ a, 60, 0] (* _Robert G. Wilson v_, Nov 10 2013 *) %o A228407 (PARI) {u=0; a=0; 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 A228407 (Python) %o A228407 from collections import Counter %o A228407 A228407_list, l, s, b = [0, 11], Counter('11'), 1, set([11]) %o A228407 for _ in range(10**2): %o A228407 i = s %o A228407 while True: %o A228407 if i not in b: %o A228407 li, o = Counter(str(i)), 0 %o A228407 for d in (l+li).values(): %o A228407 if d % 2: %o A228407 if o > 0: %o A228407 break %o A228407 o += 1 %o A228407 else: %o A228407 A228407_list.append(i) %o A228407 l = li %o A228407 b.add(i) %o A228407 while s in b: %o A228407 b.remove(s) %o A228407 s += 1 %o A228407 break %o A228407 i += 1 # _Chai Wah Wu_, Dec 14 2014 %Y A228407 Cf. A228410, A228412, A062932, A230891 (base 2 analog), A230892, A231920-A231933. %Y A228407 A228730, A231880, A231881 are similar sequences. %Y A228407 Records: A377925, A377926. %K A228407 nonn,base,nice %O A228407 0,2 %A A228407 _Eric Angelini_ and _M. F. Hasler_, Nov 09 2013 %E A228407 Terms independently calculated by _Rob Arthan_, Nov 09 2013 %E A228407 Comments edited by _N. J. A. Sloane_, Dec 14 2024