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 13 results. Next

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

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

A073788 Numbers in base -7.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 160, 161, 162, 163, 164, 165, 166, 150, 151, 152, 153, 154, 155, 156, 140, 141, 142, 143, 144, 145, 146, 130, 131, 132, 133, 134, 135, 136, 120, 121, 122, 123, 124, 125, 126, 110, 111, 112, 113, 114, 115, 116, 100, 101, 102, 103, 104, 105
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, 7], {n, 0, 60}]
  • Python
    def A073788(n):
        s, q = '', n
        while q >= 7 or q < 0:
            q, r = divmod(q, -7)
            if r < 0:
                q += 1
                r += 7
            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

A073835 Replace 10^k with (-10)^k in decimal expansion of n.

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 10 representation for n (in lexicographic order) converted from base -10 to base 10.
A bijection from N = [0..oo) to Z = (-oo..+oo), or enumeration of the integers. - M. F. Hasler, Oct 17 2018

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, 10]], {n, 0, 80}]; b = {}; Do[ b = Append[b, f[a[[n]], 10]], {n, 1, 80}]; b (* Typo fixed by Harvey P. Dale, Oct 03 2013 *)
  • PARI
    a(n)=fromdigits(digits(n),-10) \\ M. F. Hasler, Oct 17 2018

Formula

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

A051022 Interpolate 0's between each pair of digits of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 500, 501, 502, 503, 504, 505
Offset: 0

Views

Author

Eric W. Weisstein, Dec 11 1999

Keywords

Comments

These numbers have the same decimal and negadecimal representations.
Or fixed points of decimal negadecimal conversion. - Gerald Hillier, Apr 23 2015

Examples

			a(23) = 203.
a(99) = 909.
a(100) = 10000.
a(101) = 10001.
a(111) = 10101.
		

Crossrefs

Cf. A039723, A063010, A092908 (primes), A092909 (on primes), A338754 (*11).
In other bases: A000695, A037314, A276089.

Programs

  • Haskell
    a051022 n = if n < 10 then n else a051022 n' * 100 + r
                where (n', r) = divMod n 10
    -- Reinhard Zumkeller, Apr 20 2011
    (HP 49G calculator)
    « "" + SREV 0 9
      FOR i i "" + DUP 0 + SREPL DROP
      NEXT SREV OBJ->
    ». Gerald Hillier, Apr 23 2015
    
  • Maple
    M:= 3: # to get a(0) to a(10^M-1)
    A:= 0:
    for d from 1 to M do
      A:= seq(seq(a*100+b,b=0..9),a=A);
    od:
    A; # Robert Israel, Apr 23 2015
  • Mathematica
    Table[FromDigits[Riffle[IntegerDigits[n],0]],{n,0,60}] (* Harvey P. Dale, Nov 17 2013 *)
    ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]];
    k = 0; lst = {}; While[k < 1001, If[k == ToNegaBases[k, 10], AppendTo[ lst, k]]; k++]; lst (* Robert G. Wilson v, Jun 11 2014 *)
  • PARI
    a(n) = fromdigits(digits(n),100); \\ Kevin Ryde, Nov 07 2020
    
  • Python
    def a(n): return int("0".join(str(n)))
    print([a(n) for n in range(56)]) # Michael S. Branicky, Aug 15 2022

Formula

Sums a_i*100^e_i with 0 <= a_i < 10.
a(n) = n if n < 10, otherwise a(floor(n/10))*100 + n mod 10. - Reinhard Zumkeller, Apr 20 2011 [Corrected by Kevin Ryde, Nov 07 2020]
a(n) = A338754(n)/11. - Kritsada Moomuang, Oct 20 2019 [Corrected by Kevin Ryde, Nov 07 2020]

Extensions

More terms and more precise definition from Jorge Coveiro, Apr 15 2004 and David Wasserman, Feb 26 2008
Edited by N. J. A. Sloane, Sep 14 2008 at the suggestion of R. J. Mathar
Offset fixed by Reinhard Zumkeller, Apr 20 2012
Showing 1-10 of 13 results. Next