Trinomial coefficients

The coefficient of x^{n} in the expansion of (1+x+x^{2})^{t} is

Sum[Binomial[n+t-1-3k,n-3k] Binomial[t,k] (-1)^{k},{k,0,t}]

which can be evaluated as

Binomial[2t, n] Hypergeometric2F1[-n, n- 2t, 1/2 - t, 1/4]

or finally GegenbauerC[n, -t, -1/2]. This result follows directly from the generating function formula

(1 - 2 x z + x^{2})^{-m}==Sum[GegenbauerC[n, m, z] x^{n}, {n, 0, ∞}]