OFFSET
0,2
COMMENTS
For a guide to related sequences, see A211795.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
FORMULA
a(n) = n^4 - A212569(n).
a(n) = a(n-1)+3*a(n-2)-3*a(n-3)-3*a(n-5)+3*a(n-6)+a(n-7)-a(n-8).
G.f.: (1+14*x+61*x^2+104*x^3+115*x^4+50*x^5+15*x^6) / ((1+x)^3*(x-1)^4).
From Colin Barker, Jan 29 2016: (Start)
a(n) = (3*n*(10*n^2+n+(-1)^n*(n-1)+9)+2*((-1)^n+1))/4.
a(n) = (15*n^3+3*n^2+12*n+2)/2 for n even.
a(n) = (15*n^3+15*n)/2 for n odd.
(End)
EXAMPLE
For n=1, there are sixteen 4-tuples, (w,x,y,z); All but two include both 0 and 1 and have range 1. The two others, (0,0,0,0) and (1,1,1,1,), have range 0. Therefore, a(1)=15.
MATHEMATICA
Remove["Global`*"];
t = Compile[{{n, _Integer}},
Module[{s = 0}, (Do[
If[(w == # || x == # || y == # || z == #) &[
Max[w, x, y, z] - Min[w, x, y, z]], s++], {w, 0, n},
{x, 0, n}, {y, 0, n}, {z, 0, n}]; s)]];
Map[t[#] &, Range[0, 40]] (* A212746 *)
(* Peter J. C. Moses, May 24 2012 *)
LinearRecurrence[{1, 3, -3, -3, 3, 1, -1}, {1, 15, 79, 225, 529, 975, 1711}, 40] (* Harvey P. Dale, Oct 24 2018 *)
PROG
(PARI) Vec((1+14*x+61*x^2+104*x^3+115*x^4+50*x^5+15*x^6)/((1+x)^3*(x-1)^4) + O(x^100)) \\ Colin Barker, Jan 29 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 27 2012
STATUS
approved