%I #26 Oct 21 2018 13:41:32
%S 0,1,2,3,4,5,6,7,8,9,190,191,192,193,194,195,196,197,198,199,180,181,
%T 182,183,184,185,186,187,188,189,170,171,172,173,174,175,176,177,178,
%U 179,160,161,162,163,164,165,166,167,168,169,150,151,152,153,154,155
%N Numbers in base -10.
%D D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189.
%H Reinhard Zumkeller, <a href="/A039723/b039723.txt">Table of n, a(n) for n = 0..10000</a>
%H Prepared and presented by Matthew Szudzik of Wolfram Research, <a href="http://library.wolfram.com/conferences/devconf99/challenge/">A Mathematica programming contest</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Negadecimal.html">Negadecimal</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Negabinary.html">Negabinary</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Negative_base">Negative base</a>
%e Decimal 25 is "185" in base -10 because 100 - 80 + 5 = 25.
%t ToNegaBases[i_Integer, b_Integer] := FromDigits@ Rest@ Reverse@ Mod[ NestWhileList[(# - Mod[ #, b])/-b &, i, # != 0 &], b]
%o (Haskell)
%o a039723 0 = 0
%o a039723 n = a039723 n' * 10 + m where
%o (n',m) = if r < 0 then (q + 1, r + 10) else qr where
%o qr@(q, r) = quotRem n (negate 10)
%o -- _Reinhard Zumkeller_, Apr 20 2011
%o (Python)
%o def A039723(n):
%o s, q = '', n
%o while q >= 10 or q < 0:
%o q, r = divmod(q, -10)
%o if r < 0:
%o q += 1
%o r += 10
%o s += str(r)
%o return int(str(q)+s[::-1]) # _Chai Wah Wu_, Apr 10 2016
%o (PARI) A039723 = base(n, b=-10) = if(n, base(n\b, b)*10 + n%b, 0) \\ _M. F. Hasler_, Oct 16 2018 [Corrected by _Jianing Song_, Oct 21 2018]
%Y Nonnegative numbers in negative bases: this sequence (b=-10), A039724 (b=-2), A073785 (b=-3), A007608 (b=-4), A073786 (b=-5), A073787 (b=-6), A073788 (b=-7), A073789 (b=-8), A073790 (b=-9).
%Y Cf. A051022.
%Y Cf. A305238: negative numbers in base -10.
%K base,easy,nonn
%O 0,3
%A Robert Lozyniak (11(AT)onna.com)