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.

A352729 The binary expansion of a(n) contains the runs of consecutive 1's that appear both in the binary expansions of n and n+1.

Original entry on oeis.org

0, 0, 0, 0, 4, 0, 0, 0, 8, 8, 8, 0, 12, 0, 0, 0, 16, 16, 16, 16, 20, 16, 16, 0, 24, 24, 24, 0, 28, 0, 0, 0, 32, 32, 32, 32, 36, 32, 32, 32, 40, 40, 40, 32, 44, 32, 32, 0, 48, 48, 48, 48, 52, 48, 48, 0, 56, 56, 56, 0, 60, 0, 0, 0, 64, 64, 64, 64, 68, 64, 64, 64
Offset: 0

Views

Author

Rémy Sigrist, Mar 30 2022

Keywords

Comments

We only consider runs of consecutive 1's that completely match in binary expansions of n and n+1, not simply single common 1's.

Examples

			For n = 42:
- the binary expansion of 42 is "101010",
- the binary expansion of 43 is "101011",
- the first two runs of 1's are the same, the others differ,
- so the binary expansion of a(42) is "101000",
- and a(42) = 40.
		

Crossrefs

Programs

  • PARI
    A352724(n) = { my (r=[], o=0); while (n, my (v=valuation(n+n%2, 2)); if (n%2, r=concat(r, (2^v-1)*2^o)); o+=v; n\=2^v); r }
    a(n) = vecsum(setintersect(A352724(n), A352724(n+1)))

Formula

a(n) = A352727(n, n+1).