OFFSET
0,3
COMMENTS
LINKS
FORMULA
a(n) < 2^k for any n < 2^k.
a(floor(n/2)) = floor(a(n)/2).
a(2^k) = 2^(k+1) - 1 for any k >= 0.
EXAMPLE
For n = 42:
- the binary expansion of 42 is (1, 0, 1, 0, 1, 0),
- the binary expansion of a(42) has 6 digits:
- the 1st digit = 1 mod 2 = 1,
- the 2nd digit = 1 + 0 mod 2 = 1,
- the 3rd digit = 1 + 1 mod 2 = 0,
- the 4th digit = 1 + 0 + 0 mod 2 = 1,
- the 5th digit = 1 + 1 mod 2 = 0,
- the 6th digit = 1 + 0 + 1 + 0 mod 2 = 0,
- so the binary expansion of a(42) is "110100",
- and a(42) = 52.
PROG
(PARI) a(n) = { my (b=binary(n), c=vector(#b)); for (m=1, #b, fordiv (m, d, c[m]=(c[m] + b[d])%2)); fromdigits(c, 2) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 25 2021
STATUS
approved