OFFSET
1,2
LINKS
Paul D. Hanna, Table of n, a(n) for n = 1..365
EXAMPLE
a(2) = (3^1-1)/2 XOR (3^2-1)/2 = 1 XOR 4 = 5;
a(3) = (3^1-1)/2 XOR (3^2-1)/2 XOR (3^3-1)/2 = 1 XOR 4 XOR 13 = 8;
a(4) = (3^1-1)/2 XOR (3^2-1)/2 XOR (3^3-1)/2 XOR (3^4-1)/2 = 1 XOR 4 XOR 13 XOR 40 = 32.
MATHEMATICA
FoldList[BitXor, Table[(3^n - 1)/2, {n, 1, 29}]] (* Vladimir Reshetnikov, Nov 02 2015 *)
PROG
(PARI) {a(n)=if(n<=0, 0, bitxor(a(n-1), (3^n-1)/2))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Nov 05 2011
STATUS
approved