OFFSET
0,3
COMMENTS
a(n) = XOR{k AND (n-k): 0<=k<=n}.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Reinhard Zumkeller, Logical Convolutions
PROG
(Haskell)
import Data.Bits (xor, (.|.))
a142149 :: Integer -> Integer
a142149 = foldl xor 0 . zipWith (.|.) [0..] . reverse . enumFromTo 1
-- Reinhard Zumkeller, Mar 31 2015
(Python)
def A142149(n): return n if n&1 else (n^ n>>1) # Chai Wah Wu, Jun 29 2022
(PARI) a(n)=if(n%2, n, bitxor(n, n/2)) \\ Charles R Greathouse IV, Jul 01 2022
CROSSREFS
AUTHOR
Reinhard Zumkeller, Jul 15 2008
STATUS
approved