login
A348760
For any nonnegative number n with binary expansion Sum_{k >= 0} b_k * 2^k, a(n) is the real part of f(n) = Sum_{k >= 0} ((-1)^Sum_{j = 0..k-1} b_j) * (1+i)^k (where i denotes the imaginary unit); sequence A348761 gives the imaginary part.
2
0, 1, 1, 0, 0, 1, 1, 0, -2, 3, 3, -2, 2, -1, -1, 2, -4, 5, 5, -4, 4, -3, -3, 4, 2, -1, -1, 2, -2, 3, 3, -2, -4, 5, 5, -4, 4, -3, -3, 4, 2, -1, -1, 2, -2, 3, 3, -2, 0, 1, 1, 0, 0, 1, 1, 0, -2, 3, 3, -2, 2, -1, -1, 2, 0, 1, 1, 0, 0, 1, 1, 0, -2, 3, 3, -2, 2, -1
OFFSET
0,9
COMMENTS
The function f defines a bijection from the nonnegative integers to the Gaussian integers.
LINKS
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) = A146559(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++); real(v) }
CROSSREFS
See A348690 for a similar sequence.
Sequence in context: A154840 A309995 A205102 * A247108 A236439 A332780
KEYWORD
sign,base
AUTHOR
Rémy Sigrist, Oct 31 2021
STATUS
approved