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 A317050 #25 Feb 06 2024 19:31:19 %S A317050 0,1,-1,-2,2,3,5,4,-4,-3,-5,-6,-10,-9,-7,-8,8,9,7,6,10,11,13,12,20,21, %T A317050 19,18,14,15,17,16,-16,-15,-17,-18,-14,-13,-11,-12,-20,-19,-21,-22, %U A317050 -26,-25,-23,-24,-40,-39,-41,-42,-38,-37,-35,-36,-28,-27,-29,-30 %N A317050 a(0) = 0 and for any n >= 0, a(n+1) is obtained by changing the rightmost possible digit in the negabinary representation of a(n) so as to get a value not yet in the sequence. %C A317050 Binary Gray code, interpreted as negabinary number. %C A317050 This sequence is a bijection from nonnegative integers to signed integers. %C A317050 This sequence has similarities with A317018; in both sequences, the negabinary representations of consecutive terms differ exactly by one digit. %H A317050 Rémy Sigrist, <a href="/A317050/b317050.txt">Table of n, a(n) for n = 0..16383</a> %H A317050 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Negabinary.html">Negabinary</a>. %H A317050 Wikipedia, <a href="https://en.wikipedia.org/wiki/Negative_base">Negative base</a>. %F A317050 a(n) = A053985(A003188(n)). %e A317050 The first terms, alongside their negabinary representation, are: %e A317050 n a(n) nega(a(n)) %e A317050 -- ---- ---------- %e A317050 0 0 0 %e A317050 1 1 1 %e A317050 2 -1 11 %e A317050 3 -2 10 %e A317050 4 2 110 %e A317050 5 3 111 %e A317050 6 5 101 %e A317050 7 4 100 %e A317050 8 -4 1100 %e A317050 9 -3 1101 %e A317050 10 -5 1111 %e A317050 11 -6 1110 %e A317050 12 -10 1010 %e A317050 13 -9 1011 %e A317050 14 -7 1001 %e A317050 15 -8 1000 %e A317050 16 8 11000 %e A317050 17 9 11001 %e A317050 18 7 11011 %e A317050 19 6 11010 %e A317050 20 10 11110 %e A317050 a(8) = -4 because nega(a(7)) = 100. Changing the rightmost digit gives 101 of which the decimal value in the sequence. Similarily, changing to 110 and 000 gives no new term. Changing to 1100 does so a(8) is the decimal value of 1100 which is -4. - _David A. Corneth_, Jul 22 2018 %o A317050 (PARI) a(n) = fromdigits(binary(bitxor(n, n>>1)), -2) %Y A317050 Cf. A003188, A039724, A053985, A212529, A317018. %K A317050 sign,look,base %O A317050 0,4 %A A317050 _Rémy Sigrist_, Jul 20 2018