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 A355624 #12 Jul 18 2022 14:16:41 %S A355624 0,1,2,3,-2,-1,6,-5,-4,9,-8,-7,-6,7,8,-3,4,5,18,-17,-16,-15,16,17,-12, %T A355624 13,14,27,-26,-25,-24,25,26,-21,22,23,-18,19,20,21,-20,-19,24,-23,-22, %U A355624 -9,10,11,12,-11,-10,15,-14,-13,54,-53,-52,-51,52,53,-48,49 %N A355624 a(0) = 0, and for any n > 0, a(3*n) = 3*a(n), a(3*n+1) = 1-3*a(n), a(3*n+2) = 2-3*a(n). %C A355624 This sequence establishes a bijection from the nonnegative integers (N) to the integers (Z). %C A355624 This sequence is to base 3 what A065620 is to base 2. %C A355624 To compute a(n): write n as a sum of terms of A038754 with distinct 3-adic valuations and take the alternating sum. %H A355624 Rémy Sigrist, <a href="/A355624/b355624.txt">Table of n, a(n) for n = 0..6561</a> %F A355624 a(n) = n iff n = 0 or n belongs to A038754. %e A355624 For n = 107: %e A355624 107 = 3^4 + 2*3^2 + 2*3^1 + 2*3^0, %e A355624 so a(107) = -3^4 + 2*3^2 - 2*3^1 + 2*3^0 = -67. %o A355624 (PARI) a(n, base=3) = { my (d=digits(n, base), s=1); forstep (k=#d, 1, -1, if (d[k], d[k]*=s; s=-s)); return (fromdigits(d, base)) } %Y A355624 Cf. A038754, A065620, A355675. %K A355624 sign,base,easy %O A355624 0,3 %A A355624 _Rémy Sigrist_, Jul 14 2022