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.

A271472 Binary representation of n in base i-1.

This page as a plain text file.
%I A271472 #28 Jan 22 2023 20:44:40
%S A271472 0,1,1100,1101,111010000,111010001,111011100,111011101,111000000,
%T A271472 111000001,111001100,111001101,100010000,100010001,100011100,
%U A271472 100011101,100000000,100000001,100001100,100001101,110011010000,110011010001,110011011100,110011011101,110011000000,110011000001
%N A271472 Binary representation of n in base i-1.
%C A271472 This is A066321 converted from base 10 to base 2.
%C A271472 Every Gaussian integer r+s*i (r, s ordinary integers) has a unique representation as a sum of powers of t = i-1. For example 3 = 1+b^2+b^3, that is, "1101" in binary, which explains a(3) = 1101. See A066321 for further information.
%C A271472 From _Jianing Song_, Jan 22 2023: (Start)
%C A271472 Also binary representation of n in base -1-i.
%C A271472 Write out n in base -4 (A007608), then change each digit 0, 1, 2, 3 to 0000, 0001, 1100, 1101 respectively. (End)
%D A271472 D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 172. (See also exercise 16, p. 177; answer, p. 494.)
%D A271472 W. J. Penney, A "binary" system for complex numbers, JACM 12 (1965), 247-248.
%H A271472 Chai Wah Wu, <a href="/A271472/b271472.txt">Table of n, a(n) for n = 0..10000</a>
%H A271472 N. J. A. Sloane, <a href="/A066321/a066321.txt">Table of n, (I-1)^n for n=0..100</a>
%H A271472 Wikipedia, <a href="https://en.wikipedia.org/wiki/Complex-base_system">Complex-base system</a>
%o A271472 (Python)
%o A271472 from gmpy2 import c_divmod
%o A271472 u = ('0000','1000','0011','1011')
%o A271472 def A271472(n):
%o A271472     if n == 0:
%o A271472         return 0
%o A271472     else:
%o A271472         s, q = '', n
%o A271472         while q:
%o A271472             q, r = c_divmod(q, -4)
%o A271472             s += u[r]
%o A271472         return int(s[::-1]) # _Chai Wah Wu_, Apr 09 2016
%o A271472 (PARI) a(n) = my(v = [n,0], x=0, digit=0, a, b); while(v!=[0,0], a=v[1]; b=v[2]; v[1]=-2*(a\2)+b; v[2]=-(a\2); x+=(a%2)*10^digit; digit++); x \\ _Jianing Song_, Jan 22 2023; [a,b] represents the number a + b*(-1+i)
%Y A271472 Cf. A066321.
%K A271472 nonn,base,easy
%O A271472 0,3
%A A271472 _N. J. A. Sloane_, Apr 08 2016