When I studied calculus at my university there is one question that I hated the most which is given a finite number of terms for some sequence find the $n-$th term. I hated this type of question because there is obviously not a single answer to this question for example: what is the nth term of this sequence $1,2,4,8,16, \dots$? For any complex number $z$ I can make this sequence

$$\frac{-(n-2)(n-3)(n-4)(n-5)(n-6)}{5!} +\frac{2(n-1)(n-3)(n-4)(n-5)(n-6)}{4!} -\frac{4(n-1)(n-2)(n-4)(n-5)(n-6)}{12} +\frac{8(n-1)(n-2)(n-3)(n-5)(n-6)}{12} -\frac{16(n-1)(n-2)(n-3)(n-4)(n-6)}{4!} +\frac{z (n-1)(n-2)(n-3)(n-4)(n-5)}{5!} $$

This would make $z$ is what comes next after $16$.

This sequence might seem complicated but it is really easy to find any arbitrary sequence that contain $n$ terms for a sequence $x_1,x_2,\dots,x_n$ let $J=\{1,2,\dots,n \}$ the general sequence is just $$\sum_{k=1}^n x_k \frac{\prod\limits_{i\in J | i \ne k} (n-i)}{\prod\limits_{i\in J | i \ne k} (k-i)}$$

the only problem is how to compute $\prod\limits_{i\in J | i \ne k} (k-i)$? I tried to find an easy way to find the general but I failed.

  • 2
    $\begingroup$ I haven't read the question in detail, but at first glance it does make me think of Lagrange interpolation Polynomials $\endgroup$ Jan 25 at 20:02
  • $\begingroup$ @AdamRubinson I have never heard of this theorem before. $\endgroup$
    – pie
    Jan 25 at 20:05

1 Answer 1


Although not relevant to your problem, if $k>n$ the case $i=k$ will not appear and the product equals $\prod_{i\in J|i\neq k} (k-i) = k!/(k-n)!$

If $k<n$, split the product into two products $$\prod_{i\in J|i\neq k} (k-i) = \prod_{i\in J|i > k} (k-i)\prod_{i\in J|i < k} (k-i) = (-1)^{n-k}\prod_{i\in J|i > k} (i-k)\prod_{i\in J|i < k} (k-i).$$ The remaining products are just factorials again $$\prod_{i\in J|i\neq k} (k-i) = (-1)^{n-k}(n-k)!(k-1)!.$$

In the example you gave in the question, $n = 6$. The terms are $$\begin{array}{c|c|c} k & \prod_{i\in J|i\neq k} (k-i) & \text{Simplified}\\ \hline 1 & (-1)^{(6-1)} (6-1)!0! & -5! \\ \hline 2 & (-1)^{(6-2)} (6-2)!1!& 4! \\ \hline 3 & (-1)^{(6-3)} (6-3)!2!& -3!2! \\ \hline 4 & (-1)^{(6-4)} (6-4)!3!& 2!3! \\ \hline 5 & (-1)^{(6-5)} (6-5)!4!& -4! \\ \hline 6 & (-1)^{(6-6)} (6-6)!5!& 5! \end{array}$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .