OFFSET
0,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
FORMULA
a(0)=0, a(1)=1, a(n) = a(n-1) + (a(n-2) XOR n), where XOR is the bitwise exclusive-or operator.
MATHEMATICA
nxt[{n_, a_, b_}]:={n+1, b, b+BitXor[a, n+1]}; NestList[nxt, {1, 0, 1}, 40][[All, 2]] (* Harvey P. Dale, Jul 02 2021 *)
PROG
(Python)
prpr, prev = 0, 1
for n in range(2, 99):
. current = prev + (prpr ^ n)
. print prpr,
. prpr, prev = prev, current
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Alex Ratushnyak, May 04 2012
STATUS
approved