What is the next number in the sequence

1, 1, 1, 1

?

If we let the function f be

f(n) = (41/24)(n-1)(n-2)(n-3)(n-4) + 1

then we have

f(1) = 1
f(2) = 1
f(3) = 1
f(4) = 1
f(5) = 42

Therefore the next number might as well be 42. The same trick can be pulled off with any given integer sequence. In fact, it can be any number you like. This is not particularly hard to prove.

If we have been given a sequence of numbers

a_{1}, a_{2}, a_{3}, a_{4}

and we wish to find the value of a_{5}, then we are effectively being asked to find the the function f(x) such that

f(1) = a_{1}
f(2) = a_{2}
f(3) = a_{3}
f(4) = a_{4}

and then to evaluate f(5). Now, as we all know, if we are given any two points we can find a straight line through them. Given any three points we can find a parabola

f(x) = b_{2}x^{2} + b_{1}x + b_{0}

through them. Correspondingly, given any n points on a graph, we can find a polynomial of degree n-1:

f(x) = b_{0} + b_{1}x + ... + b_{n-1}x^{n-1}

which will go through of all of them. (Well, you can't if two points are directly above each other, but this is obviously impossible in this case.) This is called Lagrange interpolation. So suppose we know

f(1) = a_{1}
f(2) = a_{2}
...
f(n-1) = a_{n-1} (*)

and we want a_{n} to be 42. To find f(x), we have to solve the set of simultaneous equations;

f(1) = b_{0} + b_{1} + ... + b_{n-1} = a_{1}
f(2) = b_{0} + 2b_{1} + ... + 2^{n-1}b_{n-1} = a_{2}
...
f(n) = b_{0} + nb_{1} + ... + n^{n-1}b_{n-1} = a_{n} = 42

We have n equations with n unknowns (being the b_{k}). The solution will yield a polynomial f(x) which satisfies (*) and additionally has f(n) = a_{n}, for any given a_{n}. So for any integer sequence, you can arbitrarily pick your own next number and find a polynomial that proves you correct.

This is a very pedantic point to make, but you have to be a pedant to be a mathematician, because making unjustified assumptions while answering questions can be catastrophic. However, often the answer in questions like these is either fairly obvious or easy to find, so while this technique is an entertaining party trick (if one is at a particularly dull party), it's usually quicker to just find the next integer by traditional methods.