OFFSET
0,4
COMMENTS
For a guide to related sequences, see A211422.
Also, number of ordered pairs (w,x) with both terms in {1,...,n} and w+2x divisible by 4. - Pontus von Brömssen, Jan 19 2020
LINKS
Colin Barker, Table of n, a(n) for n = 0..999
Index entries for linear recurrences with constant coefficients, signature (1,1,-1,1,-1,-1,1).
FORMULA
a(n) = a(n-1) + a(n-2) - a(n-3) + a(n-4) - a(n-5) - a(n-6) + a(n-7).
a(n) = (2*n^2-n+1+(n-1)*(-1)^n+(-1)^((2*n+1-(-1)^n)/4)-(-1)^((6*n+1-(-1)^n)/4))/8. - Luce ETIENNE, Dec 31 2015
G.f.: x^2*(1 + x + x^2 + x^4) / ((1 - x)^3*(1 + x)^2*(1 + x^2)). - Colin Barker, Dec 02 2017
MATHEMATICA
t[n_] := t[n] = Flatten[Table[w + 2 x - 4 y, {w, 1, n}, {x, 1, n}, {y, 1, n}]]
c[n_] := Count[t[n], 0]
t = Table[c[n], {n, 0, 70}] (* A211521 *)
FindLinearRecurrence[t]
LinearRecurrence[{1, 1, -1, 1, -1, -1, 1}, {0, 0, 1, 2, 4, 5, 9}, 56] (* Ray Chandler, Aug 02 2015 *)
PROG
(PARI) concat(vector(2), Vec(x^2*(1 + x + x^2 + x^4) / ((1 - x)^3*(1 + x)^2*(1 + x^2)) + O(x^40))) \\ Colin Barker, Dec 02 2017
(Magma) a:=[0]; for n in [1..55] do m:=0; for i, j in [1..n] do if (i+2*j) mod 4 eq 0 then m:=m+1; end if; end for; Append(~a, m); end for; a; // Marius A. Burtea, Jan 19 2020
(Magma) R<x>:=PowerSeriesRing(Integers(), 57); [0, 0] cat Coefficients(R!( x^3*(1 + x + x^2 + x^4) / ((1 - x)^3*(1 + x)^2*(1 + x^2)))); // Marius A. Burtea, Jan 19 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Apr 14 2012
EXTENSIONS
Offset corrected by Pontus von Brömssen, Jan 19 2020
STATUS
approved