login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A142149 a(n) = XOR{k OR (n-k): 0<=k<=n}. 6
0, 1, 3, 3, 6, 5, 5, 7, 12, 9, 15, 11, 10, 13, 9, 15, 24, 17, 27, 19, 30, 21, 29, 23, 20, 25, 23, 27, 18, 29, 17, 31, 48, 33, 51, 35, 54, 37, 53, 39, 60, 41, 63, 43, 58, 45, 57, 47, 40, 49, 43, 51, 46, 53, 45, 55, 36, 57, 39, 59, 34, 61, 33, 63, 96, 65, 99, 67, 102, 69, 101, 71 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
a(n) = XOR{k AND (n-k): 0<=k<=n}.
LINKS
Reinhard Zumkeller, Logical Convolutions
FORMULA
a(2*n) = A048724(n) and a(2*n+1) = A005408(n).
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
Sequence in context: A050346 A319619 A309001 * A132119 A180681 A286102
KEYWORD
nonn,hear,look,easy
AUTHOR
Reinhard Zumkeller, Jul 15 2008
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 13 23:31 EDT 2024. Contains 374290 sequences. (Running on oeis4.)