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

A182509
a(0)=0, a(1)=1, a(n)=(a(n-1) XOR n) + a(n-2).
3
0, 1, 3, 1, 8, 14, 16, 37, 61, 89, 144, 244, 392, 633, 1023, 1641, 2680, 4306, 6968, 11261, 18209, 29489, 47688, 77200, 124880, 202073, 326931, 528993, 855952, 1384942, 2240896, 3625869, 5866797, 9492633, 15359464, 24852068, 40211496, 65063537, 105275007
OFFSET
0,3
COMMENTS
Terms with indices 6k+1, 6k+2, 6k+3 are odd, all other terms are even.
FORMULA
a(0)=0, a(1)=1, a(n)=(a(n-1) XOR n) + a(n-2), where XOR is the bitwise exclusive-or operator.
PROG
(Python)
prpr = 0
prev = 1
for n in range(2, 99):
current = (prev ^ n) + prpr
print prpr,
prpr = prev
prev = current
CROSSREFS
Sequence in context: A131202 A287987 A067955 * A049965 A221736 A077108
KEYWORD
nonn,base,easy
AUTHOR
Alex Ratushnyak, May 03 2012
STATUS
approved