OFFSET
1,1
COMMENTS
Number of length three 0..n vectors that contain their arithmetic mean. - Hywel Normington, Aug 15 2020
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000 (first 210 terms from R. H. Hardin)
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
Empirical: a(n) = 2*a(n-1) -2*a(n-3) +a(n-4).
Empirical for n mod 2 = 0: a(n) = (3/2)*n^2 + n + 1.
Empirical for n mod 2 = 1: a(n) = (3/2)*n^2 + n - (1/2).
From Hywel Normington, Aug 21 2020: (Start)
a(n) = a(n-1) + 1 + 6*floor(n/2)
a(n) = A319127(n+1) + n + 1 = 6*floor((n+1)/2)*floor(n/2) + n + 1.
(End)
From Colin Barker, Aug 28 2020: (Start)
G.f.: x*(2 + 5*x - 2*x^2 + x^3) / ((1 - x)^3*(1 + x)).
a(n) = (1 + 3*(-1)^n + 4*n + 6*n^2) / 4 for n>0.
(End)
EXAMPLE
Some solutions for n=6:
..2....3....6....1....3....4....3....1....6....2....4....0....4....5....4....3
..6....1....2....0....2....3....3....2....5....3....0....1....3....6....4....5
..4....5....4....2....1....5....3....3....4....1....2....2....2....4....4....4
PROG
(PARI) a(n) = {my(res = 2); if(n % 2 == 0, res+=(1 + 6*floor(n/2))); n = (n-1)>>1; res+=6*n^2 + 8*n; res} \\ David A. Corneth, Aug 26 2020
(PARI) first(n) = {my(res = vector(n), inc = 7); res[1] = 2; for(i = 2, n, res[i] = res[i-1] + inc; inc += 6 * (i%2 == 1)); res} \\ David A. Corneth, Aug 26 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
R. H. Hardin, Oct 06 2014
EXTENSIONS
Name simplified by Andrew Howroyd, Aug 14 2020
STATUS
approved