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!)
A182182 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) XOR a(n-2) 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
Eric Weisstein's World of Mathematics, 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
print('0, 1', end=', ')
for i in range(2, 101):
current = prev ^ prpr ^ i
print(current, end=", ")
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: A327438 A010467 A335320 * A158823 A184168 A122913
KEYWORD
nonn,base,look
AUTHOR
Alex Ratushnyak, Apr 17 2012
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 April 23 15:04 EDT 2024. Contains 371914 sequences. (Running on oeis4.)