login
Number of (w,x,y,z) with all terms in {0,...,n} and w=max{w,x,y,z}-2*min{w,x,y,z}.
2

%I #12 Jun 13 2015 00:54:14

%S 1,8,27,83,162,277,495,730,1025,1513,1988,2547,3413,4212,5119,6471,

%T 7678,9017,10963,12662,14517,17165,19440,21895,25353,28288,31427,

%U 35803,39482,43389,48791,53298,58057,64593,70012,75707,83485,89900

%N Number of (w,x,y,z) with all terms in {0,...,n} and w=max{w,x,y,z}-2*min{w,x,y,z}.

%C For a guide to related sequences, see A211795.

%H <a href="/index/Rec#order_10">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,3,-3,0,-3,3,0,1,-1).

%F a(n)=a(n-1)+3*a(n-3)-3*a(n-4)-3*a(n-6)+3*a(n-7)+a(n-9)-a(n-10).

%F G.f.: (1+x)*(x^8+6*x^7+13*x^6+40*x^5+18*x^4+40*x^3+13*x^2+6*x+1) / ( (1+x+x^2)^3*(1-x)^4 ).

%t t = Compile[{{n, _Integer}}, Module[{s = 0},

%t (Do[If[w == Max[w, x, y, z] - 2 Min[w, x, y, z],

%t s = s + 1],

%t {w, 0, n}, {x, 0, n}, {y, 0, n}, {z, 0, n}]; s)]];

%t Map[t[#] &, Range[0, 40]] (* A212745 *)

%t LinearRecurrence[{1, 0, 3, -3, 0, -3, 3, 0, 1, -1}, {1, 8, 27, 83, 162, 277, 495, 730, 1025, 1513}, 40]

%Y Cf. A211795.

%K nonn,easy

%O 0,2

%A _Clark Kimberling_, May 26 2012