login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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: A361322 A037221 A379759 * A259309 A212061 A287570
KEYWORD
nonn,base,easy
AUTHOR
Alex Ratushnyak, May 04 2012
STATUS
approved