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!)
A182388 a(0)=1, a(n) = (a(n-1) XOR n) + n. 1

%I #12 Jul 13 2013 12:03:45

%S 1,1,5,9,17,25,37,41,41,41,45,49,73,81,109,113,113,113,117,121,129,

%T 169,213,217,217,217,221,225,281,289,349,353,353,353,357,361,369,377,

%U 389,457,521,585,653,721,809,817,845,913,977,1041,1109,1177,1249

%N a(0)=1, a(n) = (a(n-1) XOR n) + n.

%C a(n)>=n.

%H Reinhard Zumkeller, <a href="/A182388/b182388.txt">Table of n, a(n) for n = 0..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/XOR.html">XOR</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Binary_and#XOR">Bitwise operation XOR</a>

%F a(0)=1, a(n)=(a(n-1) XOR n) + n, where XOR is the bitwise exclusive-OR operator.

%e a(5) = (a(4) XOR 5) + 5 = (17 XOR 5) + 5 = 20+5 = 25

%o (Python)

%o a=1

%o for i in range(1,55):

%o . print a,

%o . a ^= i

%o . a += i

%o (Haskell)

%o import Data.Bits (xor)

%o a182388 n = a182388_list !! n

%o a182388_list = f 0 1 where

%o f x y = y' : f (x + 1) y' :: [Integer] where y' = (x `xor` y) + x

%o -- _Reinhard Zumkeller_, Apr 29 2012

%Y Cf. A182243, A182248.

%K nonn,base

%O 0,3

%A _Alex Ratushnyak_, Apr 27 2012

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 April 27 08:58 EDT 2024. Contains 372017 sequences. (Running on oeis4.)