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 A005352 M2259 #66 Jun 27 2025 17:25:59 %S A005352 3,2,13,12,15,14,9,8,11,10,53,52,55,54,49,48,51,50,61,60,63,62,57,56, %T A005352 59,58,37,36,39,38,33,32,35,34,45,44,47,46,41,40,43,42,213,212,215, %U A005352 214,209,208,211,210,221,220,223,222,217,216,219,218,197,196,199,198,193,192,195,194,205,204,207,206,201,200 %N A005352 Base -2 representation of -n reinterpreted as binary. %D A005352 M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 101. %D A005352 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A005352 Joerg Arndt, <a href="/A005352/b005352.txt">Table of n, a(n) for n = 1..1000</a> %H A005352 Joerg Arndt, <a href="http://www.jjj.de/fxt/#fxtbook">Matters Computational (The Fxtbook)</a>, p. 58-59. %H A005352 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Negabinary.html">Negabinary</a> %H A005352 A. Wilks, <a href="/A005351/a005351.pdf">Email, May 22 1991</a> %F A005352 a(n) = A005351(-n). - _Reinhard Zumkeller_, Feb 05 2014 %e A005352 a(4) = 12 because the negabinary representation of -4 is 1100, and in ordinary binary that is 12. %e A005352 a(5) = 15 because the negabinary representation of -5 is 1111, and in binary that is 15. %t A005352 (* This function comes from the Weisstein page *) %t A005352 Negabinary[n_Integer] := Module[{t = (2/3)(4^Floor[Log[4, Abs[n] + 1] + 2] - 1)}, IntegerDigits[BitXor[n + t, t], 2]]; %t A005352 Table[FromDigits[Negabinary[n], 2], {n, -1, -50, -1}] %t A005352 (* _Alonso del Arte_, Apr 04 2011 *) %o A005352 (Haskell) %o A005352 a005352 = a005351 . negate -- _Reinhard Zumkeller_, Feb 05 2014 %o A005352 (PARI) a(n) = my(t=(32*4^logint(n+1,4)-2)/3); bitxor(t-n, t); \\ _Ruud H.G. van Tol_, Oct 19 2023 %o A005352 (Python) %o A005352 def A005352(n): %o A005352 return ((b:=(4 << (n.bit_length() | 1)) // 3) - n)^b # _Adrienne Leonardo_, Feb 03 2025 %Y A005352 Complement of A005351 in natural numbers. %Y A005352 Cf. A212529. %K A005352 nonn,base,nice,look %O A005352 1,1 %A A005352 _N. J. A. Sloane_