OFFSET
0,3
COMMENTS
Conjecture: sequence contains infinitely many zeros.
a(6*A000695(n)) = 0. [Reinhard Zumkeller, May 05 2012]
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Eric Weisstein's World of Mathematics, AND
Eric Weisstein's World of Mathematics, XOR
Wikipedia, Bitwise operation AND
Wikipedia, Bitwise operation XOR
FORMULA
a(0)=0, a(1)=1, a(n) = (a(n-1) AND a(n-2)) XOR n, where AND is the bitwise AND operator, XOR is the bitwise exclusive-or operator.
MATHEMATICA
nxt[{n_, a_, b_}]:={n+1, b, BitXor[BitAnd[a, b], n+1]}; NestList[nxt, {1, 0, 1}, 80][[All, 2]] (* Harvey P. Dale, Jan 01 2019 *)
PROG
(Python)
prpr = 0
prev = 1
for n in range(2, 55):
. current = (prev & prpr) ^ n
. print prpr,
. prpr = prev
. prev = current
(Haskell)
import Data.Bits ((.&.), xor)
a182560 n = a182560_list !! n
a182560_list = 0 : 1 : 2 : zipWith xor [3..]
(tail $ zipWith (.&.) a182560_list $ tail a182560_list) :: [Integer]
-- Reinhard Zumkeller, May 05 2012
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Alex Ratushnyak, May 05 2012
STATUS
approved