login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A330955
For any n >= 0: consider all pairs of numbers (x, y) whose binary representations can be interleaved (or shuffled) to produce the binary representation of n (possibly with leading zeros); a(n) is the greatest possible value of x AND y (where AND denotes the bitwise AND operator).
2
0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2, 2, 3, 0, 1, 2, 2, 2, 2, 2, 3, 0, 1, 2, 3, 2, 2, 2, 3, 0, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4, 4, 4, 5, 4, 5, 6, 6, 4, 4, 6, 6, 6, 6, 6, 7, 0, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4, 4, 4, 5, 4, 5, 6
OFFSET
0,11
EXAMPLE
For n = 5:
- the binary representation of 5 is "101",
- the possible values for (x, y), restricted to x >= y without loss of generality, are:
bin(5) x y x AND y
------- - - -------
"101" 5 0 0
"1/01" 1 1 1
"10/1" 2 1 0
"1/0/1" 3 0 0
- hence a(5) = 1.
PROG
(C) See Links section.
CROSSREFS
See A330925 for similar sequences.
Cf. A327188.
Sequence in context: A323275 A139514 A377352 * A330956 A190617 A068323
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 04 2020
STATUS
approved