login
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.
2
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,5
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.
FORMULA
a(n) = A352727(n, n+1).
EXAMPLE
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.
PROG
(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)))
CROSSREFS
Sequence in context: A169766 A003194 A350998 * A286875 A105570 A327054
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 30 2022
STATUS
approved