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-4 of 4 results.

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

A212542 Base 2i representation of negative integers.

Original entry on oeis.org

103, 102, 101, 100, 203, 202, 201, 200, 303, 302, 301, 300, 1030003, 1030002, 1030001, 1030000, 1030103, 1030102, 1030101, 1030100, 1030203, 1030202, 1030201, 1030200, 1030303, 1030302, 1030301, 1030300, 1020003, 1020002, 1020001, 1020000, 1020103, 1020102, 1020101, 1020100, 1020203, 1020202, 1020201, 1020200, 1020303
Offset: 1

Views

Author

Joerg Arndt, May 20 2012

Keywords

Comments

Omitting digits for odd powers of 2i (all 0's for the imaginary parts) (e.g. 1030003 --> 1303) gives A212526 (negative integers in base -4).

Examples

			a(13) = 1030003: 1*(2*i)^6 + 0 + 3*(2*i)^4 + 0 + 0 + 0 + 3*(2*i)^0 = -64 + 48 + 3 = -13.
		

Crossrefs

Cf. A212494 (base 2i representation of nonnegative integers).

Programs

  • Maple
    a:= proc(n) local d, i, l, m;
          m:= n; l:= NULL;
          for i from 0 while m>0 do
            d:= irem(m, 4, 'm');
            if irem(i, 2)=0 and d>0 then d:= 4-d; m:= m+1 fi;
            l:= d, 0, l
          od; parse(cat(l))/10
        end:
    seq(a(n), n=1..60); # Alois P. Heinz, May 20 2012

A177505 Base 2i representation of n reinterpreted in base 4.

Original entry on oeis.org

0, 1, 2, 3, 304, 305, 306, 307, 288, 289, 290, 291, 272, 273, 274, 275, 256, 257, 258, 259, 560, 561, 562, 563, 544, 545, 546, 547, 528, 529, 530, 531, 512, 513, 514, 515, 816, 817, 818, 819, 800, 801, 802, 803, 784, 785
Offset: 0

Views

Author

Alonso del Arte, Feb 03 2012

Keywords

Comments

The use of negabinary dispenses with the need for sign bits and for keeping track of signed and unsigned data types. Similarly, the use of base 2i, or quater-imaginary, dispenses with the need to represent the real and imaginary parts of a complex number separately. (The term "quater-imaginary" appears in Knuth's landmark book on computer programming).
Quater-imaginary, based on the powers of 2i (twice the imaginary unit), uses the digits 0, 1, 2, 3. For purely real positive integers, the quater-imaginary representation is the same as negaquartal (base -4) except that 0's are "riffled" in, corresponding to the odd-indexed powers of 2i which are purely imaginary numbers. Therefore, to obtain the base 2i representations of positive real numbers, the algorithm for base -4 representations can be employed with only a small adjustment.
To obtain the base 2i representation of a complex number a+bi, do as above for the real part, then again for the real part of 2i*(a+bi) = -2b+2ai, giving the digits corresponding to the odd-indexed powers of 2i. - Daniel Forgues, May 18 2012

Examples

			a(5) = 305 because 5 in base 2i is 10301 ( = (2i)^4 + 3 * (2i)^2 + (2i)^0), and (-4)^4 + 3 * (-4)^2 + (-4)^0 = 256 + 3 * 16 + 1 = 305.
		

References

  • Donald Knuth, The Art of Computer Programming. Volume 2, 2nd Edition. Reading, Massachussetts: Addison-Wesley (1981): 189

Crossrefs

Cf. A005351 (base -2 representation of n reinterpreted as binary).
Cf. A212494 (base 2i representation of n).

Programs

  • Mathematica
    (* First run the program from A039724 to define ToNegaBases *) Table[FromDigits[Riffle[IntegerDigits[ToNegaBases[n, 4]], 0], 4], {n, 0, 63}]

Formula

Conjectures from Colin Barker, Jul 16 2019: (Start)
G.f.: x*(1 + x + x^2 + 301*x^3 + x^4 + x^5 + x^6 - 19*x^7 + x^8 + x^9 + x^10 - 19*x^11 + x^12 + x^13 + x^14 - 19*x^15) / ((1 - x)^2*(1 + x)*(1 + x^2)*(1 + x^4)*(1 + x^8)).
a(n) = a(n-1) + a(n-16) - a(n-17) for n>16.
(End)

A262433 Quater-imaginary representation of the Gaussian primes with an even imaginary part.

Original entry on oeis.org

3, 11, 13, 21, 31, 101, 111, 113, 123, 133, 201, 211, 213, 223, 233, 301, 321, 323, 331, 1003, 1011, 1021, 1031, 1033, 1101, 1113, 1123, 1131, 1133, 1201, 1203, 1213, 1223, 1231, 1233, 1311, 1321, 1323, 2001, 2011, 2031, 2033, 2103, 2113, 2131, 2133, 2203
Offset: 1

Views

Author

Adam J.T. Partridge, Sep 22 2015

Keywords

Comments

Not all Gaussian primes will be in this list as complex numbers with an odd imaginary part require a value after the radix point (".") in the quater-imaginary number system.

Examples

			1231_(2i) = 1(2i)^3 + 2(2i)^2 + 3(2i)^1 + 1(2i)^0 = -7-2i which is a Gaussian prime.
		

Crossrefs

A002145 when translated using A212494 is a subsequence.
Real and imaginary parts of the Gaussian primes A103431, A103432.
Showing 1-4 of 4 results.