login
A182537
a(0)=0, a(1)=1, a(n) = a(n-1) + (a(n-2) XOR n).
2
0, 1, 3, 5, 12, 12, 22, 33, 63, 103, 156, 264, 408, 669, 1075, 1733, 2792, 4540, 7350, 11877, 19207, 31095, 50312, 81384, 131704, 213097, 344779, 557885, 902676, 1460532, 2363198, 3823721, 6186887, 10010575, 16197492, 26208096, 42405552, 68613621, 111019147, 179632733
OFFSET
0,3
LINKS
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
Sequence in context: A361111 A361322 A037221 * A259309 A212061 A287570
KEYWORD
nonn,base,easy
AUTHOR
Alex Ratushnyak, May 04 2012
STATUS
approved