cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A199402 Binary XOR of 2^k - (-1)^k as k varies from 1 to n.

Original entry on oeis.org

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

Views

Author

Paul D. Hanna, Nov 05 2011

Keywords

Comments

a(n) is divisible by 3; compare to A199403.

Examples

			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.
		

Crossrefs

Cf. A199403.

Programs

  • 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
  • PARI
    {a(n)=if(n<0,0,bitxor(a(n-1),2^n-(-1)^n))}

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