A229763 a(n) = (2*n) XOR n AND n, where AND and XOR are bitwise logical operators.
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
Offset: 0
Examples
From _Kevin Ryde_, Feb 27 2021: (Start) n = 1831 = binary 11100100111 a(n) = 289 = binary 100100001 low 1-bit each run (End)
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..8191
- Hsien-Kuei Hwang, Svante Janson, and Tsung-Hsi Tsai, Identities and periodic oscillations of divide-and-conquer recurrences splitting at half, arXiv:2210.10968 [cs.DS], 2022, p. 41.
Crossrefs
Programs
-
Haskell
import Data.Bits ((.&.), xor, shiftL) a229763 n = (shiftL n 1 `xor` n) .&. n :: Int -- Reinhard Zumkeller, Oct 10 2013
-
Mathematica
Array[BitAnd[BitXor[2 #, #], #] &, 75, 0] (* Michael De Vlieger, Nov 03 2022 *)
-
PARI
a(n) = bitnegimply(n,n<<1); \\ Kevin Ryde, Feb 27 2021
-
Python
for n in range(333): print (2*n ^ n) & n,
-
Python
def A229763(n): return n&~(n<<1) # Chai Wah Wu, Jun 29 2022
Formula
a(n) = ((2*n) XOR n) AND n = ((2*n) AND n) XOR n.
a(2n) = 2a(n), a(2n+1) = A229762(n). - Ralf Stephan, Oct 07 2013
a(n) = n AND NOT 2n. - Chai Wah Wu, Jun 29 2022
G.f.: x/(1 - x^2) + Sum_{k>=1}(2^k*x^(2^k)/((1 - x)*(1 + x^(2^k))*(1 + x^(2^(k - 1))))). - Miles Wilson, Jan 24 2025
Comments