OFFSET
0,2
COMMENTS
Here i = sqrt(-1).
From Jianing Song, Jan 22 2023: (Start)
Also binary representation of base-(-1-i) expansion of -n.
Write out -n in base -4 (A212526), change each digit 0, 1, 2, 3 to 0000, 0001, 1100, 1101 respectively, then interpret as a binary number. (End)
LINKS
Paul Tek, Table of n, a(n) for n = 0..10000
Paul Tek, Perl program for this sequence
Wikipedia, Complex-base system
FORMULA
For n >= 1, a(4*n-0..3) = 16 * A066321(n) + 0, 1, 12, 13 respectively. - Jianing Song, Jan 22 2023
EXAMPLE
a(5) = 205 = 2^7 + 2^6 + 2^3 + 2^2 + 2^0 since (i-1)^7 + (i-1)^6 + (i-1)^3 + (i-1)^2 + (i-1)^0 = -5.
PROG
(Perl) See Links section.
(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)*2^digit; digit++); x \\ Jianing Song, Jan 22 2023; [a, b] represents the number a + b*(-1+i)
CROSSREFS
KEYWORD
base,nonn,easy
AUTHOR
Paul Tek, Mar 29 2015
STATUS
approved