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 A371635 #11 Apr 02 2024 14:36:10 %S A371635 0,1,3,2,4,10,8,9,6,7,5,11,12,13,30,29,31,24,23,25,27,26,28,18,17,19, %T A371635 21,20,22,15,14,16,33,32,34,36,35,37,39,38,40,91,89,90,86,87,88,93,94, %U A371635 92,73,71,72,68,69,70,75,76,74,82,80,81,77,78,79,84,85,83 %N A371635 For any number k >= 0, let T_k be the triangle with values in {-1, 0, +1} whose base corresponds to the balanced ternary expansion of k (without leading zeros) and other values, say t above u and v, satisfy t+u+v = 0 mod 3; the balanced ternary expansion of a(n) corresponds to the left border of T_n (the most significant digit being at the bottom left corner). %C A371635 This sequence is a variant of A334727 and A361832. %C A371635 This sequence is a self-inverse permutation of the nonnegative integers. %H A371635 Rémy Sigrist, <a href="/A371635/b371635.txt">Table of n, a(n) for n = 0..9841</a> %H A371635 <a href="/index/X#XOR-triangles">Index entries for sequences related to XOR-triangles</a> %H A371635 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A371635 For n = 42: the balanced ternary expansion of 42 is "1TTT0" (where T denotes -1), and T_42 is as follows: %e A371635 T %e A371635 0 1 %e A371635 1 T 0 %e A371635 0 T T 1 %e A371635 1 T T T 0 %e A371635 So the balanced ternary expansion of a(42) is "1010T", and a(42) = 89. %o A371635 (PARI) a(n) = { my (b = [], d); while (n, b = concat(d = Mod(n, 3), b); n = (n-centerlift(d)) / 3;); my (t = vector(#b)); for (i = 1, #t, t[i] = centerlift(b[1]); b = -vector(#b-1, j, b[j]+b[j+1]);); fromdigits(t, 3); } %Y A371635 Cf. A334727, A361832, A371636. %K A371635 nonn,base %O A371635 0,3 %A A371635 _Rémy Sigrist_, Mar 30 2024