OFFSET
0,5
COMMENTS
The function f defines a bijection from the nonnegative integers to the Gaussian integers.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8191
Rémy Sigrist, Colored representation of f(n) for n < 2^20 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 2)
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))
Rémy Sigrist, Colored representation of f(n) for n < 2^18 in the complex plane (the color is function of A000120(n), darker shades correspond to higher values)
FORMULA
a(2^k) = A009545(k) for any k >= 0.
PROG
(PARI) a(n) = { my (v=0, k, o=-1); while (n, n-=2^k=valuation(n, 2); v+=(1+I)^k * (-1)^o++); imag(v) }
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Oct 31 2021
STATUS
approved