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 A134028 #36 Feb 16 2025 08:33:06 %S A134028 0,1,-2,1,4,-11,-2,7,-8,1,10,-5,4,13,-38,-11,16,-29,-2,25,-20,7,34, %T A134028 -35,-8,19,-26,1,28,-17,10,37,-32,-5,22,-23,4,31,-14,13,40,-119,-38, %U A134028 43,-92,-11,70,-65,16,97,-110,-29,52,-83,-2,79,-56,25,106,-101,-20,61,-74,7,88,-47,34,115,-116,-35,46,-89,-8,73,-62,19,100 %N A134028 Reversal of n in balanced ternary representation. %C A134028 As the graph demonstrates, the sequence makes large negative steps at terms (3^i+1)/2. These steps divide the graph into conspicuous blocks. - _N. J. A. Sloane_, Jul 03 2016 %D A134028 D. E. Knuth, The Art of Computer Programming, Addison-Wesley, Reading, MA, Vol 2, pp 173-175. %H A134028 Reinhard Zumkeller, <a href="/A134028/b134028.txt">Table of n, a(n) for n = 0..10000</a> %H A134028 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Reversal.html">Reversal</a> %H A134028 Wikipedia, <a href="http://en.wikipedia.org/wiki/Balanced_ternary">Balanced Ternary</a> %F A134028 a(A134027(n)) = A134027(n); %F A134028 A134021(ABS(a(n))) <= A134021(n). %e A134028 20 = 1*3^3 - 1*3^2 + 1*3^1 - 1*3^0 == '+-+-' %e A134028 => a(20) = -1*3^3 + 1*3^2 - 1*3^1 + 1*3^0 = -20; %e A134028 21 = 1*3^3 - 1*3^2 + 1*3^1 + 0*3^0 == '+-+0' %e A134028 => a(21) = 0*3^3 + 1*3^2 - 1*3^1 + 1*3^0 = 7; %e A134028 22 = 1*3^3 - 1*3^2 + 1*3^1 + 1*3^0 == '+-++' %e A134028 => a(22) = 1*3^3 + 1*3^2 - 1*3^1 + 1*3^0 = 34; %e A134028 23 = 1*3^3 + 0*3^2 - 1*3^1 - 1*3^0 == '+0--' %e A134028 => a(23) = -1*3^3 - 1*3^2 + 0*3^1 + 1*3^0 = -35; %e A134028 24 = 1*3^3 + 0*3^2 - 1*3^1 + 0*3^0 == '+0-0' %e A134028 => a(24) = 0*3^3 - 1*3^2 + 0*3^1 + 1*3^0 = -8; %e A134028 25 = 1*3^3 + 0*3^2 - 1*3^1 + 1*3^0 == '+0-+' %e A134028 => a(25) = 1*3^3 - 1*3^2 + 0*3^1 + 1*3^0 = 19. %o A134028 (Python) %o A134028 def a(n): %o A134028 if n==0: return 0 %o A134028 s=[] %o A134028 x=0 %o A134028 while n>0: %o A134028 x=n%3 %o A134028 n=n//3 %o A134028 if x==2: %o A134028 x=-1 %o A134028 n+=1 %o A134028 s.append(x) %o A134028 l=s[::-1] %o A134028 return sum(l[i]*3**i for i in range(len(l))) %o A134028 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 10 2017 %Y A134028 Cf. A117966 (balanced ternary representation), A030102, A134021, A274107. %Y A134028 A134027 gives the numbers whose balanced ternary representation is palindromic. %K A134028 sign,look,base %O A134028 0,3 %A A134028 _Reinhard Zumkeller_, Oct 19 2007