login
A212746
Number of (w,x,y,z) with all terms in {0,...,n} and at least one of them is the range of {w,x,y,z}.
3
1, 15, 79, 225, 529, 975, 1711, 2625, 3985, 5535, 7711, 10065, 13249, 16575, 20959, 25425, 31201, 36975, 44335, 51585, 60721, 69615, 80719, 91425, 104689, 117375, 132991, 147825, 165985, 183135, 204031, 223665, 247489, 269775, 296719, 321825, 352081, 380175
OFFSET
0,2
COMMENTS
For a guide to related sequences, see A211795.
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
Sequence in context: A269436 A044202 A044583 * A212741 A082540 A372952
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 27 2012
STATUS
approved