|
|
A229763
|
|
a(n) = (2*n) XOR n AND n, where AND and XOR are bitwise logical operators.
|
|
2
|
|
|
0, 1, 2, 1, 4, 5, 2, 1, 8, 9, 10, 9, 4, 5, 2, 1, 16, 17, 18, 17, 20, 21, 18, 17, 8, 9, 10, 9, 4, 5, 2, 1, 32, 33, 34, 33, 36, 37, 34, 33, 40, 41, 42, 41, 36, 37, 34, 33, 16, 17, 18, 17, 20, 21, 18, 17, 8, 9, 10, 9, 4, 5, 2, 1, 64, 65, 66, 65, 68, 69, 66, 65, 72, 73, 74
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
a(n) is the least significant 1-bit of each run of consecutive 1's in n, and everywhere else 0's. Or equivalently, clear to 0 each 1-bit which has another 1 immediately below. - Kevin Ryde, Feb 27 2021
|
|
LINKS
|
|
|
FORMULA
|
a(n) = ((2*n) XOR n) AND n = ((2*n) AND n) XOR n.
|
|
EXAMPLE
|
n = 1831 = binary 11100100111
a(n) = 289 = binary 100100001 low 1-bit each run
(End)
|
|
MATHEMATICA
|
|
|
PROG
|
(Python)
for n in range(333): print (2*n ^ n) & n,
(Python)
(Haskell)
import Data.Bits ((.&.), xor, shiftL)
a229763 n = (shiftL n 1 `xor` n) .&. n :: Int
(PARI) a(n) = bitnegimply(n, n<<1); \\ Kevin Ryde, Feb 27 2021
|
|
CROSSREFS
|
Cf. A213064 (n XOR (n*2) AND (n*2)).
Cf. A229762 (n XOR floor(n/2) AND floor(n/2), 1-bit below each run).
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|