cp's OEIS Frontend

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.

A039723 Numbers in base -10.

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