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 A073789 #15 Feb 16 2025 08:32:46 %S A073789 0,1,2,3,4,5,6,7,170,171,172,173,174,175,176,177,160,161,162,163,164, %T A073789 165,166,167,150,151,152,153,154,155,156,157,140,141,142,143,144,145, %U A073789 146,147,130,131,132,133,134,135,136,137,120,121,122,123,124,125,126 %N A073789 Numbers in base -8. %D A073789 D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189. %H A073789 Reinhard Zumkeller, <a href="/A073789/b073789.txt">Table of n, a(n) for n = 0..10000</a> %H A073789 Prepared and presented by Matthew Szudzik of Wolfram Research, <a href="http://library.wolfram.com/conferences/devconf99/challenge/">A Mathematica programming contest</a> %H A073789 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Negabinary.html">Negabinary</a> %H A073789 Wikipedia, <a href="http://en.wikipedia.org/wiki/Negative_base">Negative base</a> %t A073789 ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]]; Table[ ToNegaBases[n, 8], {n, 0, 60}] %o A073789 (Haskell) %o A073789 a073789 0 = 0 %o A073789 a073789 n = a073789 n' * 10 + m where %o A073789 (n', m) = if r < 0 then (q + 1, r + 8) else (q, r) %o A073789 where (q, r) = quotRem n (negate 8) %o A073789 -- _Reinhard Zumkeller_, Jul 07 2012 %o A073789 (Python) %o A073789 def A073789(n): %o A073789 s, q = '', n %o A073789 while q >= 8 or q < 0: %o A073789 q, r = divmod(q, -8) %o A073789 if r < 0: %o A073789 q += 1 %o A073789 r += 8 %o A073789 s += str(r) %o A073789 return int(str(q)+s[::-1]) # _Chai Wah Wu_, Apr 09 2016 %Y A073789 Cf. A007094, A039724, A073785, A007608, A073786, A073787, A073788, A073790 & A039723. %K A073789 base,easy,nonn %O A073789 0,3 %A A073789 _Robert G. Wilson v_, Aug 11 2002