cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A229762 a(n) = (n XOR floor(n/2)) AND floor(n/2), where AND and XOR are bitwise logical operators.

This page as a plain text file.
%I A229762 #28 Jun 29 2022 17:41:10
%S A229762 0,0,1,0,2,2,1,0,4,4,5,4,2,2,1,0,8,8,9,8,10,10,9,8,4,4,5,4,2,2,1,0,16,
%T A229762 16,17,16,18,18,17,16,20,20,21,20,18,18,17,16,8,8,9,8,10,10,9,8,4,4,5,
%U A229762 4,2,2,1,0,32,32,33,32,34,34,33,32,36,36,37,36,34,34,33
%N A229762 a(n) = (n XOR floor(n/2)) AND floor(n/2), where AND and XOR are bitwise logical operators.
%C A229762 a(n) has a 01 bit pair in place of each 10 bit pair in n, and everywhere else 0 bits.  Or equivalently a(n) has a 1-bit immediately below each run of 1's in n, but excluding a run ending at the least significant bit since below that is below the radix point. - _Kevin Ryde_, Feb 27 2021
%H A229762 Reinhard Zumkeller, <a href="/A229762/b229762.txt">Table of n, a(n) for n = 0..8191</a>
%F A229762 a(n) = (n XOR floor(n/2)) AND floor(n/2) = (n AND floor(n/2)) XOR floor(n/2).
%F A229762 a(n) = floor(n/2) AND NOT n. - _Chai Wah Wu_, Jun 29 2022
%e A229762 From _Kevin Ryde_, Feb 27 2021: (Start)
%e A229762      n = 7267 = binary 1110001100011
%e A229762   a(n) =  528 = binary   01000010000   1-bit below each run
%e A229762 (End)
%o A229762 (Python)
%o A229762 for n in range(333): print (n ^ (n>>1)) & (n>>1),
%o A229762 (Python)
%o A229762 def A229762(n): return ~n& n>>1 # _Chai Wah Wu_, Jun 29 2022
%o A229762 (Haskell)
%o A229762 import Data.Bits ((.&.), xor, shiftR)
%o A229762 a229762 n = (n `xor` shiftR n 1) .&. shiftR n 1 :: Int
%o A229762 -- _Reinhard Zumkeller_, Oct 10 2013
%o A229762 (PARI) a(n) = bitnegimply(n>>1,n); \\ _Kevin Ryde_, Feb 27 2021
%Y A229762 Cf. A003188 (n XOR floor(n/2)).
%Y A229762 Cf. A048724 (n XOR (n*2)).
%Y A229762 Cf. A048735 (n AND floor(n/2)).
%Y A229762 Cf. A213370 (n AND (n*2)).
%Y A229762 Cf. A213064 (n XOR (n*2) AND (n*2), 1-bit above each run).
%Y A229762 Cf. A229763 ((2*n) XOR n AND n, low 1-bit each run).
%K A229762 nonn,base,easy
%O A229762 0,5
%A A229762 _Alex Ratushnyak_, Sep 28 2013