OFFSET
0,5
COMMENTS
The function f defines a bijection from the nonnegative integers to the Gaussian integers.
The function f has similarities with A065620; here the nonzero digits in base 1+i cycle through powers of i, there nonzero digits in base 2 cycle through powers of -1.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8191
Chandler Davis and Donald Knuth, Number representations and Dragon Curves I, Journal of Recreational Mathematics, volume 3, number 2 (April 1970), pages 66-81. Reprinted in Donald E. Knuth, Selected Papers on Fun and Games, CSLI Publications, 2011, pages 571-614.
Rémy Sigrist, Colored representation of f(n) for n < 2^18 in the complex plane (the hue is function of n)
Rémy Sigrist, Colored representation of f(n) for n < 2^18 in the complex plane (the color is function of A000120(n) mod 4)
Rémy Sigrist, Colored representation of f(n) for n < 2^18 in the complex plane (the color is function of the binary length of n, A070939(n))
FORMULA
a(2^k) = A009545(k) for any k >= 0.
PROG
(PARI) a(n) = { my (v=0, o=0, x); while (n, n-=2^x=valuation(n, 2); v+=I^o * (1+I)^x; o++); imag(v) }
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Oct 29 2021
STATUS
approved