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.

A073790 Numbers in base -9.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 180, 181, 182, 183, 184, 185, 186, 187, 188, 170, 171, 172, 173, 174, 175, 176, 177, 178, 160, 161, 162, 163, 164, 165, 166, 167, 168, 150, 151, 152, 153, 154, 155, 156, 157, 158, 140, 141, 142, 143, 144, 145, 146, 147, 148, 130, 131
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[(# - Mod[ #, b])/-b &, i, # != 0 &], b]; Table[ ToNegaBases[n, 9], {n, 0, 60}]
  • Python
    def A073790(n):
        s, q = '', n
        while q >= 9 or q < 0:
            q, r = divmod(q, -9)
            if r < 0:
                q += 1
                r += 9
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016