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.

A073786 Numbers in base -5.

Original entry on oeis.org

0, 1, 2, 3, 4, 140, 141, 142, 143, 144, 130, 131, 132, 133, 134, 120, 121, 122, 123, 124, 110, 111, 112, 113, 114, 100, 101, 102, 103, 104, 240, 241, 242, 243, 244, 230, 231, 232, 233, 234, 220, 221, 222, 223, 224, 210, 211, 212, 213, 214, 200, 201, 202, 203
Offset: 0

Views

Author

Robert G. Wilson v, Aug 11 2002

Keywords

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189.

Crossrefs

Programs

  • Mathematica
    ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]]; Table[ ToNegaBases[n, 5], {n, 0, 55}]
  • Python
    def A073786(n):
        s, q = '', n
        while q >= 5 or q < 0:
            q, r = divmod(q, -5)
            if r < 0:
                q += 1
                r += 5
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016