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 A374990 #12 Jul 28 2024 12:50:35 %S A374990 0,1,5,3,9,2,11,7,17,4,21,6,19,22,23,15,33,8,41,12,37,10,13,14,35,38, %T A374990 43,27,39,46,47,31,65,16,81,24,73,20,25,28,69,18,85,26,77,45,29,30,67, %U A374990 70,83,51,75,86,91,59,71,78,87,55,79,94,95,63,129,32,161 %N A374990 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the concatenation of the binary expansions of n and a(n), in at least one way, is palindromic. %C A374990 Leading zeros in binary expansions are ignored. %C A374990 This sequence is a self-inverse permutation of the nonnegative integers. %H A374990 Rémy Sigrist, <a href="/A374990/b374990.txt">Table of n, a(n) for n = 0..8191</a> %H A374990 Rémy Sigrist, <a href="/A374990/a374990.gp.txt">PARI program</a> %H A374990 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A374990 The first terms, in decimal and in binary, alongside an appropriate palindrome, are: %e A374990 n a(n) bin(n) bin(a(n)) palindromes %e A374990 -- ---- ------ --------- ----------- %e A374990 0 0 0 0 0 %e A374990 1 1 1 1 11 %e A374990 2 5 10 101 10101 %e A374990 3 3 11 11 1111 %e A374990 4 9 100 1001 1001001 %e A374990 5 2 101 10 10101 %e A374990 6 11 110 1011 1101011 %e A374990 7 7 111 111 111111 %e A374990 8 17 1000 10001 100010001 %e A374990 9 4 1001 100 1001001 %e A374990 10 21 1010 10101 101010101 %e A374990 11 6 1011 110 1101011 %e A374990 12 19 1100 10011 110010011 %o A374990 (PARI) \\ See Links section. %o A374990 (Python) %o A374990 from itertools import count, islice %o A374990 def p(s): return s == s[::-1] %o A374990 def c(v, w): return p(v+w) or p(w+v) %o A374990 def agen(): # generator of terms %o A374990 mink, a = 0, set() %o A374990 for n in count(0): %o A374990 bn = bin(n)[2:] %o A374990 an = next(k for k in count(mink) if k not in a and c(bin(k)[2:], bn)) %o A374990 yield an %o A374990 a.add(an) %o A374990 while mink in a: mink += 1 %o A374990 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Jul 28 2024 %Y A374990 Cf. A006995, A057889. %K A374990 nonn,base %O A374990 0,3 %A A374990 _Rémy Sigrist_, Jul 26 2024