A182537 a(0)=0, a(1)=1, a(n) = a(n-1) + (a(n-2) XOR n).
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
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
Programs
-
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 *)
-
Python
prpr, prev = 0, 1 for n in range(2, 99): current = prev + (prpr ^ n) print(prpr, end=', ') prpr, prev = prev, current
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.