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.

Showing 1-3 of 3 results.

A326729 a(0) = 0; for n >= 1, a(n) is the result of inverting s-th bit (from right) in n, where s is the number of ones in the binary representation of n.

Original entry on oeis.org

0, 0, 3, 1, 5, 7, 4, 3, 9, 11, 8, 15, 14, 9, 10, 7, 17, 19, 16, 23, 22, 17, 18, 31, 26, 29, 30, 19, 24, 21, 22, 15, 33, 35, 32, 39, 38, 33, 34, 47, 42, 45, 46, 35, 40, 37, 38, 63, 50, 53, 54, 59, 48, 61, 62, 39, 60, 49, 50, 43, 52, 45, 46, 31, 65, 67, 64, 71, 70, 65, 66, 79, 74, 77, 78, 67, 72, 69, 70, 95, 82, 85, 86, 91, 80, 93, 94, 71, 92, 81, 82, 75, 84, 77, 78, 127, 98, 101, 102, 107, 96
Offset: 0

Views

Author

Max Alekseyev, Jul 22 2019

Keywords

Comments

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

Crossrefs

Programs

  • 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
  • PARI
    A326729(n) = if(n==0,return(0)); bitxor(n,2^(hammingweight(n)-1));

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)

A326730 Number of iterations of A326729(x) starting at x = n to reach 0.

Original entry on oeis.org

0, 1, 3, 2, 5, 4, 6, 3, 7, 6, 8, 5, 10, 7, 9, 4, 9, 8, 10, 7, 12, 9, 11, 6, 14, 11, 13, 8, 15, 10, 12, 5, 11, 10, 12, 9, 14, 11, 13, 8, 16, 13, 15, 10, 17, 12, 14, 7, 18, 15, 17, 12, 19, 14, 16, 9, 21, 16, 18, 11, 20, 13, 15, 6, 13, 12, 14, 11, 16, 13, 15, 10, 18, 15, 17, 12, 19, 14, 16, 9, 20, 17, 19, 14, 21, 16, 18, 11, 23, 18, 20, 13, 22, 15, 17, 8, 22, 19, 21, 16, 23
Offset: 0

Views

Author

Max Alekseyev, Jul 22 2019

Keywords

Comments

The sequence is well-defined, see Problem 5 of IMO 2019.

Crossrefs

Programs

  • PARI
    A326730(n) = my(b=Vecrev(binary(n)), m=vecsum(b)); 2*sum(i=1,#b,i*b[i]) - m^2;

Formula

a(n) = 2*A029931(n) - A000120(n)^2.

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.
Showing 1-3 of 3 results.