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 A343602 #13 Apr 23 2021 01:20:35 %S A343602 0,1,-2,3,4,-11,-8,-5,-6,9,12,7,10,13,-38,-35,-32,-29,-26,-23,-20,-17, %T A343602 -14,-33,-24,-15,-18,27,36,21,30,39,16,19,22,25,28,31,34,37,40,-119, %U A343602 -116,-113,-110,-107,-104,-101,-98,-95,-92,-89,-86,-83,-80,-77,-74 %N A343602 For any positive number n, the balanced ternary representation of a(n) is obtained by left-rotating the balanced ternary representation of n until a nonzero digit appears again as the leftmost digit; a(0) = 0. %C A343602 This sequence can be extended to negative indexes by setting a(-n) = -a(n) for any n > 0. We then obtain a permutation of the integers (Z) with inverse A343601 (after a similar extension to negative indexes). %H A343602 Rémy Sigrist, <a href="/A343602/b343602.txt">Table of n, a(n) for n = 0..9841</a> %F A343602 A065363(a(n)) = A065363(n). %F A343602 A134021(a(n)) = A134021(n). %F A343602 a^k(n) = n for k = A005812(n) (where a^k denotes the k-th iterate of a). %e A343602 The first terms, in base 10 and in balanced ternary (where T denotes the digit -1), are: %e A343602 n a(n) bter(n) bter(a(n)) %e A343602 -- ---- ------- ---------- %e A343602 0 0 0 0 %e A343602 1 1 1 1 %e A343602 2 -2 1T T1 %e A343602 3 3 10 10 %e A343602 4 4 11 11 %e A343602 5 -11 1TT TT1 %e A343602 6 -8 1T0 T01 %e A343602 7 -5 1T1 T11 %e A343602 8 -6 10T T10 %e A343602 9 9 100 100 %e A343602 10 12 101 110 %e A343602 11 7 11T 1T1 %e A343602 12 10 110 101 %e A343602 13 13 111 111 %e A343602 14 -38 1TTT TTT1 %e A343602 15 -35 1TT0 TT01 %o A343602 (PARI) a(n) = { my (d = [], t); while (n, d = concat(t = centerlift(Mod(n,3)), d); n = (n-t)\3); for (k=2, #d, if (d[k], return (fromdigits(concat(d[k..#d], d[1..k-1]), 3)))); return (fromdigits(d, 3)) } %Y A343602 Cf. A005812, A065363, A134021, A139708 (binary variant), A343600 (ternary variant), A343603 (inverse). %K A343602 sign,base %O A343602 0,3 %A A343602 _Rémy Sigrist_, Apr 21 2021