cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Max Alekseyev, Jul 22 2019

Keywords

Comments

Iterations of a(n) always reach 0 (cf. A326732), see Problem 5 of IMO 2019.

Crossrefs

A variant of A326729.

Programs

  • PARI
    A326731(n) = if(n==0,return(0)); my(b=binary(n)); bitxor(n,2^(#b-vecsum(b)));

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.