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”).

a(0)=0, a(1)=1, a(n)=(a(n-1) XOR n) + a(n-2).
3

%I #5 May 04 2012 12:50:15

%S 0,1,3,1,8,14,16,37,61,89,144,244,392,633,1023,1641,2680,4306,6968,

%T 11261,18209,29489,47688,77200,124880,202073,326931,528993,855952,

%U 1384942,2240896,3625869,5866797,9492633,15359464,24852068,40211496,65063537,105275007

%N a(0)=0, a(1)=1, a(n)=(a(n-1) XOR n) + a(n-2).

%C Terms with indices 6k+1, 6k+2, 6k+3 are odd, all other terms are even.

%F a(0)=0, a(1)=1, a(n)=(a(n-1) XOR n) + a(n-2), where XOR is the bitwise exclusive-or operator.

%o (Python)

%o prpr = 0

%o prev = 1

%o for n in range(2,99):

%o current = (prev ^ n) + prpr

%o print prpr,

%o prpr = prev

%o prev = current

%K nonn,base,easy

%O 0,3

%A _Alex Ratushnyak_, May 03 2012