

A182182


a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n1) XOR a(n2) XOR n.


1



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, 10, 10, 31, 53, 11, 28, 52, 12, 29, 55, 13, 18, 54, 14, 19, 49, 15, 16, 48, 16, 17, 51, 17, 22, 50, 18, 23, 61, 19, 20, 60, 20, 21, 63, 21, 106, 62, 22, 107, 57
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

Note that a(3n) = n.


LINKS

T. D. Noe, Table of n, a(n) for n = 0..1023
Eric Weisstein's World of Mathematics, XOR
Wikipedia, Bitwise operation XOR


MATHEMATICA

t = {0, 1}; Do[AppendTo[t, BitXor[n, t[[1]], t[[2]]]], {n, 2, 100}]; t (* T. D. Noe, Apr 18 2012 *)
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 *)


PROG

(Python)
prpr = 0
prev = 1
for i in range(2, 101):
. current = prev ^ prpr ^ i
. print current,
. prpr = prev
. prev = current
(Haskell)
import Data.Bits (xor)
a182182 n = a182182_list !! n
a182182_list = 0 : 1 : zipWith xor [2..]
(zipWith xor a182182_list $ tail a182182_list) :: [Integer]
Reinhard Zumkeller, Apr 23 2012


CROSSREFS

Cf. A038712.
Sequence in context: A104573 A327438 A010467 * A158823 A184168 A122913
Adjacent sequences: A182179 A182180 A182181 * A182183 A182184 A182185


KEYWORD

nonn,base,look


AUTHOR

Alex Ratushnyak, Apr 17 2012


STATUS

approved



