%I #31 Nov 03 2022 08:20:05
%S 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,
%T 5,2,1,32,33,34,33,36,37,34,33,40,41,42,41,36,37,34,33,16,17,18,17,20,
%U 21,18,17,8,9,10,9,4,5,2,1,64,65,66,65,68,69,66,65,72,73,74
%N a(n) = (2*n) XOR n AND n, where AND and XOR are bitwise logical operators.
%C 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
%H Reinhard Zumkeller, <a href="/A229763/b229763.txt">Table of n, a(n) for n = 0..8191</a>
%H Hsien-Kuei Hwang, Svante Janson, and Tsung-Hsi Tsai, <a href="https://arxiv.org/abs/2210.10968">Identities and periodic oscillations of divide-and-conquer recurrences splitting at half</a>, arXiv:2210.10968 [cs.DS], 2022, p. 41.
%F a(n) = ((2*n) XOR n) AND n = ((2*n) AND n) XOR n.
%F a(2n) = 2a(n), a(2n+1) = A229762(n). - _Ralf Stephan_, Oct 07 2013
%F a(n) = n AND NOT 2n. - _Chai Wah Wu_, Jun 29 2022
%e From _Kevin Ryde_, Feb 27 2021: (Start)
%e n = 1831 = binary 11100100111
%e a(n) = 289 = binary 100100001 low 1-bit each run
%e (End)
%t Array[BitAnd[BitXor[2 #, #], #] &, 75, 0] (* _Michael De Vlieger_, Nov 03 2022 *)
%o (Python)
%o for n in range(333): print (2*n ^ n) & n,
%o (Python)
%o def A229763(n): return n&~(n<<1) # _Chai Wah Wu_, Jun 29 2022
%o (Haskell)
%o import Data.Bits ((.&.), xor, shiftL)
%o a229763 n = (shiftL n 1 `xor` n) .&. n :: Int
%o -- _Reinhard Zumkeller_, Oct 10 2013
%o (PARI) a(n) = bitnegimply(n,n<<1); \\ _Kevin Ryde_, Feb 27 2021
%Y Cf. A003188 (n XOR floor(n/2)).
%Y Cf. A048724 (n XOR (n*2)).
%Y Cf. A048735 (n AND floor(n/2)).
%Y Cf. A213370 (n AND (n*2)).
%Y Cf. A213064 (n XOR (n*2) AND (n*2)).
%Y Cf. A229762 (n XOR floor(n/2) AND floor(n/2), 1-bit below each run).
%Y Cf. A292272 (high 1-bit each run).
%K nonn,base,easy,look
%O 0,3
%A _Alex Ratushnyak_, Sep 28 2013