OFFSET
0,2
COMMENTS
Note that each Gaussian integer has one and only one base-(i-1) representation.
Also binary representation of -n in base -1-i.
Write out -n in base -4 (A212526), then change each digit 0, 1, 2, 3 to 0000, 0001, 1100, 1101 respectively.
LINKS
Jianing Song, Table of n, a(n) for n = 0..16384
Wikipedia, Complex-base system
FORMULA
For n >= 1, a(4*n-0..3) = 10000 * A271472(n) + 0, 1, 1100, 1101 respectively.
EXAMPLE
a(1) = 11101 since -1 = (i-1)^4 + (i-1)^3 + (i-1)^2 + (i-1)^0. Also, the base-(-4) representation of -1 is 13_(-4), so changing 1 to 0001 and 3 to 1101 yields 11101.
a(5) = 11001101 since -5 = (i-1)^7 + (i-1)^6 + (i-1)^3 + (i-1)^2 + (i-1)^0. Also, the base-(-4) representation of -5 is 23_(-4), so changing 2 to 1100 and 3 to 1101 yields 11001101.
PROG
(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)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Jianing Song, Jan 22 2023
STATUS
approved