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.

Showing 1-10 of 10 results.

A039724 a(n) is the negabinary expansion of n, that is, the expansion of n in base -2.

Original entry on oeis.org

0, 1, 110, 111, 100, 101, 11010, 11011, 11000, 11001, 11110, 11111, 11100, 11101, 10010, 10011, 10000, 10001, 10110, 10111, 10100, 10101, 1101010, 1101011, 1101000, 1101001, 1101110, 1101111, 1101100, 1101101, 1100010, 1100011, 1100000, 1100001, 1100110, 1100111, 1100100
Offset: 0

Views

Author

Robert Lozyniak (11(AT)onna.com)

Keywords

Comments

The numbers written in base -2.
a(A007583(n)) are the only terms with all 1s digits; the number of digits = 2n + 1. - Bob Selcoe, Aug 21 2016

Examples

			2 = 4 + (-2) + 0 = 110_(-2), 3 = 4 + (-2) + 1 = 111_(-2), ..., 6 = 16 + (-8) + 0 + (-2) + 0 = 11010_(-2).
		

References

  • M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 101.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189.

Crossrefs

Nonnegative numbers in negative bases: A039723 (b=-10), this sequence (b=-2), A073785 (b=-3), A007608 (b=-4), A073786 (b=-5), A073787 (b=-6), A073788 (b=-7), A073789 (b=-8), A073790 (b=-9).
Cf. A212529 (negative numbers in base -2).

Programs

  • Haskell
    a039724 0 = 0
    a039724 n = a039724 n' * 10 + m where
       (n', m) = if r < 0 then (q + 1, r + 2) else (q, r)
                 where (q, r) = quotRem n (negate 2)
    -- Reinhard Zumkeller, Jul 07 2012
    
  • Maple
    f:= proc(n) option remember; 10*floor((n mod 4)/2) + (n mod 2) + 100*procname(round(n/4)) end proc:
    f(0):= 0:
    seq(f(i),i=0..100); # Robert Israel, Feb 24 2016
  • Mathematica
    ToNegaBases[ i_Integer, b_Integer ] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[ (#1 - Mod[ #1, b ])/-b &, i, #1 != 0 & ], b ] ] ] ]; Table[ ToNegaBases[ n, 2 ], {n, 0, 31} ]
  • PARI
    A039724(n)=if(n,A039724(n\(-2))*10+bittest(n,0)) \\ M. F. Hasler, Oct 16 2018
  • Python
    def A039724(n):
        s, q = '', n
        while q >= 2 or q < 0:
            q, r = divmod(q, -2)
            if r < 0:
                q += 1
                r += 2
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016
    

Formula

G.f. g(x) satisfies g(x) = (x + 10*x^2 + 11*x^3)/(1 - x^4) + 100(1 + x + x^2 + x^3)*g(x^4)/x^2. - Robert Israel, Feb 24 2016

Extensions

More terms from Eric W. Weisstein

A007608 Nonnegative integers in base -4.

Original entry on oeis.org

0, 1, 2, 3, 130, 131, 132, 133, 120, 121, 122, 123, 110, 111, 112, 113, 100, 101, 102, 103, 230, 231, 232, 233, 220, 221, 222, 223, 210, 211, 212, 213, 200, 201, 202, 203, 330, 331, 332, 333, 320, 321, 322, 323, 310, 311, 312, 313, 300, 301, 302, 303, 13030
Offset: 0

Views

Author

Keywords

Comments

The base 2i representation (quater-imaginary representation) of nonnegative integers is obtained by interleaving with zeros, cf. A212494.
More precisely, a(n) is the number n written in base -4; numbers [which represent some nonnegative integer] in base -4 are 0, 1, 2, 3, 100, 101, 102, 103, 110, 111, 112, 113, 120, 121, 122, 123, 130, 131, 132, 133, ... (A212556) - M. F. Hasler, May 20 2012

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A212556 (sorted), A066323 (sum of digits), A212526 (negative integers in base -4).

Programs

  • Haskell
    a007608 0 = 0
    a007608 n = a007608 n' * 10 + m where
       (n', m) = if r < 0 then (q + 1, r + 4) else (q, r)
                 where (q, r) = quotRem n (negate 4)
    -- Reinhard Zumkeller, Jul 15 2012
    
  • Mathematica
    ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]]; Table[ ToNegaBases[n, 4], {n, 0, 55}]
  • PARI
    A007608(n,s="")={until(!n\=-4,s=Str(n%-4,s));eval(s)}  \\ M. F. Hasler, May 20 2012
    
  • Python
    def A007608(n):
        s, q = '', n
        while q >= 4 or q < 0:
            q, r = divmod(q, -4)
            if r < 0:
                q += 1
                r += 4
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016

A039723 Numbers in base -10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 150, 151, 152, 153, 154, 155
Offset: 0

Views

Author

Robert Lozyniak (11(AT)onna.com)

Keywords

Examples

			Decimal 25 is "185" in base -10 because 100 - 80 + 5 = 25.
		

References

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

Crossrefs

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).
Cf. A051022.
Cf. A305238: negative numbers in base -10.

Programs

  • Haskell
    a039723 0 = 0
    a039723 n = a039723 n' * 10 + m where
       (n',m) = if r < 0 then (q + 1, r + 10) else qr where
                qr@(q, r) = quotRem n (negate 10)
    -- Reinhard Zumkeller, Apr 20 2011
    
  • Mathematica
    ToNegaBases[i_Integer, b_Integer] := FromDigits@ Rest@ Reverse@ Mod[ NestWhileList[(# - Mod[ #, b])/-b &, i, # != 0 &], b]
  • 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]
  • Python
    def A039723(n):
        s, q = '', n
        while q >= 10 or q < 0:
            q, r = divmod(q, -10)
            if r < 0:
                q += 1
                r += 10
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 10 2016
    

A073785 Numbers in base -3.

Original entry on oeis.org

0, 1, 2, 120, 121, 122, 110, 111, 112, 100, 101, 102, 220, 221, 222, 210, 211, 212, 200, 201, 202, 12020, 12021, 12022, 12010, 12011, 12012, 12000, 12001, 12002, 12120, 12121, 12122, 12110, 12111, 12112, 12100, 12101, 12102, 12220, 12221, 12222
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

Cf. A007089.
Nonnegative numbers in negative bases: A039723 (b=-10), A039724 (b=-2), this sequence (b=-3), A007608 (b=-4), A073786 (b=-5), A073787 (b=-6), A073788 (b=-7), A073789 (b=-8), A073790 (b=-9).
Cf. A320636 (negative numbers in base -3).

Programs

  • Haskell
    a073785 0 = 0
    a073785 n = a073785 n' * 10 + m where
       (n', m) = if r < 0 then (q + 1, r + 3) else (q, r)
                 where (q, r) = quotRem n (negate 3)
    -- Reinhard Zumkeller, Jul 07 2012
    
  • Mathematica
    ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]]; Table[ ToNegaBases[n, 3], {n, 0, 45}]
  • PARI
    A073785 = base(n, b=-3) = if(n, base(n\b, b)*10 + n%b, 0) \\ Jianing Song, Oct 20 2018
  • Python
    def A073785(n):
        s, q = '', n
        while q >= 3 or q < 0:
            q, r = divmod(q, -3)
            if r < 0:
                q += 1
                r += 3
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016
    

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

A073787 Numbers in base -6.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 150, 151, 152, 153, 154, 155, 140, 141, 142, 143, 144, 145, 130, 131, 132, 133, 134, 135, 120, 121, 122, 123, 124, 125, 110, 111, 112, 113, 114, 115, 100, 101, 102, 103, 104, 105, 250, 251, 252, 253, 254, 255, 240, 241, 242, 243, 244, 245
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, 6], {n, 0, 60}]
  • Python
    def A073787(n):
        s, q = '', n
        while q >= 6 or q < 0:
            q, r = divmod(q, -6)
            if r < 0:
                q += 1
                r += 6
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016

A073789 Numbers in base -8.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 170, 171, 172, 173, 174, 175, 176, 177, 160, 161, 162, 163, 164, 165, 166, 167, 150, 151, 152, 153, 154, 155, 156, 157, 140, 141, 142, 143, 144, 145, 146, 147, 130, 131, 132, 133, 134, 135, 136, 137, 120, 121, 122, 123, 124, 125, 126
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

  • Haskell
    a073789 0 = 0
    a073789 n = a073789 n' * 10 + m where
       (n', m) = if r < 0 then (q + 1, r + 8) else (q, r)
                 where (q, r) = quotRem n (negate 8)
    -- Reinhard Zumkeller, Jul 07 2012
    
  • Mathematica
    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}]
  • Python
    def A073789(n):
        s, q = '', n
        while q >= 8 or q < 0:
            q, r = divmod(q, -8)
            if r < 0:
                q += 1
                r += 8
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016

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

A073794 Replace 7^k with (-7)^k in base 7 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, -7, -6, -5, -4, -3, -2, -1, -14, -13, -12, -11, -10, -9, -8, -21, -20, -19, -18, -17, -16, -15, -28, -27, -26, -25, -24, -23, -22, -35, -34, -33, -32, -31, -30, -29, -42, -41, -40, -39, -38, -37, -36, 49, 50, 51, 52, 53, 54, 55, 42, 43, 44, 45, 46, 47, 48, 35, 36, 37, 38, 39, 40, 41
Offset: 0

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 7 representation for n (in lexicographic order) converted from base -7 to base 10.

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 7]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 7]], {n, 1, 80}]; b

Formula

a(7*k+m) = -7*a(k)+m for 0 <= m < 7. - Chai Wah Wu, Jan 16 2020

A320636 Negative numbers in base -3.

Original entry on oeis.org

12, 11, 10, 22, 21, 20, 1202, 1201, 1200, 1212, 1211, 1210, 1222, 1221, 1220, 1102, 1101, 1100, 1112, 1111, 1110, 1122, 1121, 1120, 1002, 1001, 1000, 1012, 1011, 1010, 1022, 1021, 1020, 2202, 2201, 2200, 2212, 2211, 2210, 2222, 2221, 2220, 2102, 2101, 2100, 2112
Offset: 1

Views

Author

Jianing Song, Oct 18 2018

Keywords

Comments

Extend A073785 to negative-indexed terms, then a(n) = A073785(-n).

Examples

			-7 in base -3 is represented as 1202 (1*(-3)^3 + 2*(-3)^2 + 2 = -7), so a(7) = 1202;
-16 in base -3 is represented as 1102 (1*(-3)^3 + 1*(-3)^2 + 2 = -16), so a(16) = 1102;
-40 in base -3 is represented as 2222 (2*(-3)^3 + 2*(-3)^2 + 2*(-3) + 2 = -99), so a(40) = 2222.
		

Crossrefs

Nonnegative numbers in negative bases: A039723 (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).
Negative numbers in negative bases: A305238 (b=-10), A212529 (b=-2), this sequence (b=-3), A212526 (b=-4).

Programs

Showing 1-10 of 10 results.