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”).
%I #10 Jul 02 2021 11:53:50
%S 0,1,3,5,12,12,22,33,63,103,156,264,408,669,1075,1733,2792,4540,7350,
%T 11877,19207,31095,50312,81384,131704,213097,344779,557885,902676,
%U 1460532,2363198,3823721,6186887,10010575,16197492,26208096,42405552,68613621,111019147,179632733
%N a(0)=0, a(1)=1, a(n) = a(n-1) + (a(n-2) XOR n).
%H Harvey P. Dale, <a href="/A182537/b182537.txt">Table of n, a(n) for n = 0..1000</a>
%F a(0)=0, a(1)=1, a(n) = a(n-1) + (a(n-2) XOR n), where XOR is the bitwise exclusive-or operator.
%t 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 *)
%o (Python)
%o prpr, prev = 0, 1
%o for n in range(2, 99):
%o . current = prev + (prpr ^ n)
%o . print prpr,
%o . prpr, prev = prev, current
%Y Cf. A182509, A182536.
%K nonn,base,easy
%O 0,3
%A _Alex Ratushnyak_, May 04 2012