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 A357616 #11 Oct 10 2022 03:19:41 %S A357616 0,2,1,6,8,5,3,7,4,18,20,11,24,26,17,15,23,14,9,19,10,21,25,16,12,22, %T A357616 13,54,56,29,60,62,35,33,47,32,72,74,51,78,80,53,59,71,44,45,61,34,65, %U A357616 77,50,38,52,41,27,55,28,57,69,42,30,46,31,63,73,48,75,79 %N A357616 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the number of 1's in the ternary expansion of n equals the number of 2's in the ternary expansion of a(n) and vice versa. %C A357616 This sequence is a self-inverse permutation of the nonnegative integers. %H A357616 Rémy Sigrist, <a href="/A357616/b357616.txt">Table of n, a(n) for n = 0..6560</a> %H A357616 Rémy Sigrist, <a href="/A357616/a357616.gp.txt">PARI program</a> %H A357616 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A357616 A081603(a(n)) = A062756(n). %F A357616 A062756(a(n)) = A081603(n). %F A357616 a(n) < 3^k iff n < 3^k. %F A357616 a(n) = n iff n belongs to A039001. %F A357616 Empirically: %F A357616 - a(n) = n/2 iff n belongs to A005823, %F A357616 - a(n) = 2*n iff n belongs to A005836. %e A357616 The first terms, alongside their ternary expansions, are: %e A357616 n a(n) ter(n) ter(a(n)) %e A357616 -- ---- ------ --------- %e A357616 0 0 0 0 %e A357616 1 2 1 2 %e A357616 2 1 2 1 %e A357616 3 6 10 20 %e A357616 4 8 11 22 %e A357616 5 5 12 12 %e A357616 6 3 20 10 %e A357616 7 7 21 21 %e A357616 8 4 22 11 %e A357616 9 18 100 200 %e A357616 10 20 101 202 %e A357616 11 11 102 102 %e A357616 12 24 110 220 %o A357616 (PARI) See Links section. %Y A357616 Cf. A004488, A005823, A005836, A039001 (fixed points), A062756, A081603, A352760. %K A357616 nonn,base %O A357616 0,2 %A A357616 _Rémy Sigrist_, Oct 06 2022