login
A199402
Binary XOR of 2^k - (-1)^k as k varies from 1 to n.
3
3, 0, 9, 6, 39, 24, 153, 102, 615, 408, 2457, 1638, 9831, 6552, 39321, 26214, 157287, 104856, 629145, 419430, 2516583, 1677720, 10066329, 6710886, 40265319, 26843544, 161061273, 107374182, 644245095, 429496728, 2576980377, 1717986918, 10307921511, 6871947672
OFFSET
1,1
COMMENTS
a(n) is divisible by 3; compare to A199403.
LINKS
FORMULA
G.f.: 3*(2*x^3-x^2+1)*x/(4*x^6-x^4-4*x^2+1). - Alois P. Heinz, Nov 05 2011
EXAMPLE
a(2) = 2^1+1 XOR 2^2-1 = 3 XOR 3 = 0;
a(3) = 2^1+1 XOR 2^2-1 XOR 2^3+1 = 3 XOR 3 XOR 9 = 9;
a(4) = 2^1+1 XOR 2^2-1 XOR 2^3+1 XOR 2^4-1 = 3 XOR 3 XOR 9 XOR 15 = 6.
MAPLE
a:= n-> (<<0|1|0>, <0|0|1>, <-4|1|4>>^iquo(n-1, 2, 'r'). `if`(r=0, <<3, 9, 39>>, <<0, 6, 24>>))[1, 1]: seq(a(n), n=1..100); # Alois P. Heinz, Nov 05 2011
PROG
(PARI) {a(n)=if(n<0, 0, bitxor(a(n-1), 2^n-(-1)^n))}
CROSSREFS
Cf. A199403.
Sequence in context: A176109 A342361 A291252 * A011083 A321463 A197689
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Nov 05 2011
STATUS
approved