OFFSET
1,2
COMMENTS
Note that any such sequence has at least 3 balls and at most n+2, and that three matching balls must all be the same color.
LINKS
Jeremy M. Dover, Repetition in Colored Sequences of Balls, arXiv:1710.06049 [math.CO], 2017.
FORMULA
a(n) = n! * Sum_{k=3..n+2} binomial(k,3)/(n+2-k)!.
EXAMPLE
For n=2 colors a, b, the a(n)=10 sequences of balls are: aaa, bbb, abbb, babb, bbab, bbba, baaa, abaa, aaba, aaab.
MATHEMATICA
Table[n!*Sum[Binomial[k, 3]/(n + 2 - k)!, {k, 3, n + 2}], {n, 19}] (* Michael De Vlieger, Sep 28 2017 *)
PROG
(PARI) a(n) = n! * sum(k=3, n+2, binomial(k, 3)/(n+2-k)!); \\ Michel Marcus, Sep 29 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeremy Dover, Sep 27 2017
STATUS
approved