login
A326731
a(0) = 0; for n >= 1, a(n) = result of inverting s-th bit (from left) in n, where s is the number of ones in the binary representation of n.
4
0, 0, 0, 2, 0, 7, 4, 6, 0, 13, 14, 9, 8, 15, 12, 14, 0, 25, 26, 23, 28, 17, 18, 21, 16, 29, 30, 25, 24, 31, 28, 30, 0, 49, 50, 43, 52, 45, 46, 35, 56, 33, 34, 47, 36, 41, 42, 45, 32, 57, 58, 55, 60, 49, 50, 53, 48, 61, 62, 57, 56, 63, 60, 62, 0, 97, 98, 83, 100, 85, 86, 79, 104, 89, 90, 67, 92, 69, 70, 75, 112, 65, 66, 91, 68, 93, 94, 83, 72, 81, 82, 95, 84, 89, 90, 93, 64, 113, 114, 107, 116
OFFSET
0,4
COMMENTS
Iterations of a(n) always reach 0 (cf. A326732), see Problem 5 of IMO 2019.
LINKS
International Mathematical Olympiad, Problem 5 of IMO 2019.
FORMULA
For n>=1, a(n) = n XOR 2^(A029837(n)-A000120(n)).
For n>=1, a(n) = 0 iff n is a power of 2.
PROG
(PARI) A326731(n) = if(n==0, return(0)); my(b=binary(n)); bitxor(n, 2^(#b-vecsum(b)));
CROSSREFS
A variant of A326729.
Sequence in context: A196767 A307216 A011343 * A021486 A258990 A351727
KEYWORD
nonn,base
AUTHOR
Max Alekseyev, Jul 22 2019
STATUS
approved