cp's OEIS Frontend

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.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

0, 11, 1, 10, 100, 12, 2, 20, 101, 22, 3, 13, 31, 103, 30, 110, 33, 4, 14, 41, 104, 40, 114, 24, 42, 112, 21, 102, 120, 201, 210, 1000, 105, 15, 5, 25, 52, 115, 35, 53, 113, 23, 32, 121, 26, 6, 16, 61, 106, 60, 116, 36, 63, 131, 34, 43, 134, 143, 314
Offset: 0

Views

Author

Eric Angelini and M. F. Hasler, Nov 09 2013

Keywords

Comments

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.
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)
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],...
See A228410 for the variant considering only positive integers, and comments about the differences.
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.
From N. J. A. Sloane, Nov 13 2013: (Start)
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.
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.
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.
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.
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.
At least one node must be visited infinitely often.
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.
Thanks to Rob Arthan for comments on the original version of this proof. (End)
From Robert G. Wilson v, Dec 31 2013: (Start)
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]
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, ... ;
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)

Examples

			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.
The third term can be 1 because 111 is a palindrome.
		

Crossrefs

A228730, A231880, A231881 are similar sequences.
Records: A377925, A377926.

Programs

  • Mathematica
    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 *)
  • PARI
    {u=0; a=0; for(n=1,99, u+=1<
    				
  • Python
    from collections import Counter
    A228407_list, l, s, b = [0, 11], Counter('11'), 1, set([11])
    for _ in range(10**2):
        i = s
        while True:
            if i not in b:
                li, o = Counter(str(i)), 0
                for d in (l+li).values():
                    if d % 2:
                        if o > 0:
                            break
                        o += 1
                else:
                    A228407_list.append(i)
                    l = li
                    b.add(i)
                    while s in b:
                        b.remove(s)
                        s += 1
                    break
            i += 1 # Chai Wah Wu, Dec 14 2014

Extensions

Terms independently calculated by Rob Arthan, Nov 09 2013
Comments edited by N. J. A. Sloane, Dec 14 2024

A228410 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.

Original entry on oeis.org

1, 10, 100, 11, 2, 12, 21, 102, 20, 101, 22, 3, 13, 31, 103, 30, 110, 33, 4, 14, 41, 104, 40, 114, 24, 42, 112, 23, 32, 113, 34, 43, 131, 35, 5, 15, 51, 105, 50, 115, 25, 52, 121, 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
Offset: 1

Views

Author

M. F. Hasler, Nov 09 2013

Keywords

Comments

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.
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.
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], ...
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.
Sequences A231433 and A231442 are variants where "palindrome" is replaced with "prime".

Crossrefs

Programs

  • PARI
    {u=0; a=1; for(n=1,99, u+=1<
    				
  • Python
    from collections import Counter
    A228410_list, l, s, b = [1], Counter('1'), 2, set()
    for _ in range(10**2):
        i = s
        while True:
            if i not in b:
                li, o = Counter(str(i)), 0
                for d in (l+li).values():
                    if d % 2:
                        if o > 0:
                            break
                        o += 1
                else:
                    A228410_list.append(i)
                    l = li
                    b.add(i)
                    while s in b:
                        b.remove(s)
                        s += 1
                    break
            i += 1 # Chai Wah Wu, Dec 14 2014
Showing 1-2 of 2 results.