OFFSET
0,3
COMMENTS
Iterations of a(n) always reach 0 (cf. A326730), see Problem 5 of IMO 2019.
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
International Mathematical Olympiad, Problem 5 of IMO 2019.
FORMULA
For n>=1, a(n) = n XOR 2^(A000120(n)-1).
From Robert Israel, Oct 01 2020: (Start)
a(2*n+1) = 2*a(n).
a(2*n + 2^k) = 2*a(n)+2^k if 2^k > 2*n. (End)
MAPLE
f:= proc(n) local s;
s:= convert(convert(n, base, 2), `+`);
Bits:-Xor(n, 2^(s-1))
end proc:
f(0):= 0:
map(f, [$0..100]); # Robert Israel, Oct 01 2020
PROG
(PARI) A326729(n) = if(n==0, return(0)); bitxor(n, 2^(hammingweight(n)-1));
CROSSREFS
KEYWORD
AUTHOR
Max Alekseyev, Jul 22 2019
STATUS
approved