login
A212133
Number of (w,x,y,z) with all terms in {1,...,n} and median=mean.
9
0, 1, 8, 33, 88, 185, 336, 553, 848, 1233, 1720, 2321, 3048, 3913, 4928, 6105, 7456, 8993, 10728, 12673, 14840, 17241, 19888, 22793, 25968, 29425, 33176, 37233, 41608, 46313, 51360, 56761, 62528, 68673, 75208, 82145, 89496, 97273, 105488, 114153, 123280
OFFSET
0,3
COMMENTS
For a guide to related sequences, see A211795.
For n>=1, a(n) is the number of cells in the n-th rhombic-dodecahedral polycube. - George Sicherman, Jan 22 2024
FORMULA
a(n) = 4*a(n-1) - 6*a(n-2) + 4*a(n-3) - a(n-4).
a(n) = n * (2*n^2 - 3*n + 2). - J. M. Bergot, Jun 22 2012
a(n) = A000384(n) + n*A000384(n-1). - Bruno Berselli, Jun 07 2013
a(n) = (A005917(n) + 1) / 2 for n > 0. - Reinhard Zumkeller, Nov 13 2014
G.f.: x*(1 + 4*x + 7*x^2) / (1 - x)^4. - Colin Barker, Dec 02 2017
EXAMPLE
a(2) counts these 4-tuples: (1,1,1,1), (1,1,2,2), (1,2,1,2), (2,1,1,2), (1,2,2,1), (2,1,2,1), (2,2,1,1), (2,2,2,2).
MATHEMATICA
t = Compile[{{n, _Integer}},
Module[{s = 0}, (Do[If[Apply[Plus, Rest[Most[Sort[{w, x, y, z}]]]]/2 == (w + x + y + z)/4, s = s + 1], {w, 1, #}, {x, 1, #}, {y, 1, #}, {z, 1, #}] &[n]; s)]];
Flatten[Map[{t[#]} &, Range[0, 50]]] (* A212133 *)
(* Peter J. C. Moses, May 01 2012 *)
PROG
(PARI) a(n)=2*n^3-3*n^2+2*n; \\ Joerg Arndt, Jun 22 2012
(PARI) concat(0, Vec(x*(1 + 4*x + 7*x^2) / (1 - x)^4 + O(x^40))) \\ Colin Barker, Dec 02 2017
(Haskell)
a212133 n = if n == 0 then 0 else (a005917 n + 1) `div` 2
-- Reinhard Zumkeller, Nov 13 2014
CROSSREFS
Cf. A211795.
Cf. A226449. - Bruno Berselli, Jun 09 2013
Cf. A005917.
Sequence in context: A212679 A204468 A140867 * A212574 A210698 A114105
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 04 2012
EXTENSIONS
Closed form adapted to the offset by Bruno Berselli, Jun 07 2013
STATUS
approved