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.
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
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.
Links
- Chai Wah Wu, Table of n, a(n) for n = 0..30000 (first 5354 terms from Robert G. Wilson v, next 4646 terms from Lars Blomberg)
- Rob Arthan, in reply to E. Angelini, Re: Two make a palindrome, SeqFan list, Nov 09 2013
Crossrefs
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
Comments