|
|
A330602
|
|
a(n) = a(n-1) XOR (n+1), with a(0) = 0.
|
|
1
|
|
|
0, 2, 1, 5, 0, 6, 1, 9, 0, 10, 1, 13, 0, 14, 1, 17, 0, 18, 1, 21, 0, 22, 1, 25, 0, 26, 1, 29, 0, 30, 1, 33, 0, 34, 1, 37, 0, 38, 1, 41, 0, 42, 1, 45, 0, 46, 1, 49, 0, 50, 1, 53, 0, 54, 1, 57, 0, 58, 1, 61, 0, 62, 1, 65, 0, 66, 1, 69, 0, 70, 1, 73, 0, 74, 1, 77, 0, 78
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
LINKS
|
|
|
FORMULA
|
a(n) = a(n-1) XOR (n+1), with a(0) = 0.
G.f.: x*(2 + x + 3*x^2 - x^3 - x^4) / ((1 - x)^2*(1 + x)^2*(1 + x^2)).
a(n) = a(n-2) + a(n-4) - a(n-6) for n>5.
(End)
E.g.f.: ((1 + 2*x)*cosh(x) - cos(x) - sin(x) + 3*sinh(x))/2.
a(n) = (2 + n - (-1)^n*(1 + n) - A057077(n))/2. (End)
|
|
MATHEMATICA
|
a[0] = 0; a[n_] := a[n] = BitXor[a[n-1], n+1]; Array[a, 100, 0] (* Amiram Eldar, Dec 19 2019 *)
LinearRecurrence[{0, 1, 0, 1, 0, -1}, {0, 2, 1, 5, 0, 6}, 80] (* Harvey P. Dale, Aug 07 2022 *)
|
|
PROG
|
(JavaScript) function generate (n) {
let seq = [];
for (let i = 1; i < n; i++) { seq.push(i) };
let last = 0;
return [0, ...seq.map(i => last = last ^ (i + 1))];
}
(PARI) concat(0, Vec(x*(2 + x + 3*x^2 - x^3 - x^4) / ((1 - x)^2*(1 + x)^2*(1 + x^2)) + O(x^70))) \\ Colin Barker, Dec 19 2019
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|