login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A182182 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) XOR a(n-2) XOR n. 1

%I

%S 0,1,3,1,6,2,2,7,13,3,4,12,4,5,15,5,26,14,6,27,9,7,24,8,8,25,11,9,30,

%T 10,10,31,53,11,28,52,12,29,55,13,18,54,14,19,49,15,16,48,16,17,51,17,

%U 22,50,18,23,61,19,20,60,20,21,63,21,106,62,22,107,57

%N a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) XOR a(n-2) XOR n.

%C Note that a(3n) = n.

%H T. D. Noe, <a href="/A182182/b182182.txt">Table of n, a(n) for n = 0..1023</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/Bitwise_operation#XOR">Bitwise operation XOR</a>

%t t = {0, 1}; Do[AppendTo[t, BitXor[n, t[[-1]], t[[-2]]]], {n, 2, 100}]; t (* _T. D. Noe_, Apr 18 2012 *)

%t nxt[{n_,a_,b_}]:={n+1,b,BitXor[a,b,n+1]}; Transpose[NestList[nxt,{1,0,1},100]] [[2]] (* _Harvey P. Dale_, Aug 14 2013 *)

%o (Python)

%o prpr = 0

%o prev = 1

%o for i in range(2,101):

%o . current = prev ^ prpr ^ i

%o . print current,

%o . prpr = prev

%o . prev = current

%o (Haskell)

%o import Data.Bits (xor)

%o a182182 n = a182182_list !! n

%o a182182_list = 0 : 1 : zipWith xor [2..]

%o (zipWith xor a182182_list $ tail a182182_list) :: [Integer]

%o _Reinhard Zumkeller_, Apr 23 2012

%Y Cf. A038712.

%K nonn,base,look

%O 0,3

%A _Alex Ratushnyak_, Apr 17 2012

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 20 10:09 EST 2019. Contains 329334 sequences. (Running on oeis4.)