# Can it be proven that we can construct a function that generates an arbitrary sequence of number?

I was reading the question https://math.stackexchange.com/q/310276/35144. @vsz mentioned the use of Dirac impulse to generate a function that can return the first four numbers and an arbitrary function. @user1354557 mentioned a function "where n is any real number of your choice".

I read about Dirac delta function, but I'm still not sure how that can be used to solve the problem at hand (prove that the next number of a sequence can be anything).

My question is, can it be proven that, given a sequence of numbers and a "potentially next" number, we can construct a function that generates the sequence with that exact next number?

Actually, the question can be reduced to, can it be proven that, given a sequence of numbers, we can construct a function that produces the exact sequence?

I should also note, as a programmer, such a function is trivial to me. How is it different in math?

• Delicate problem. Depending on how the exercise/question is formulated, there may be this unwished way: given a finite sequence of real numbers $(a_i)$, $i=1,\dots n$ say, there always exists a polynomial with real coefficients $f$ such that $f(i) = a_i$ for all $i=1\dots n$ (if you permit sufficiently high degree). – Ben Feb 22 '13 at 14:07

For any finite sequence, the answer is yes. It is even an analogy with your program that just stores the desired sequence returns the requested index. Given the length of the sequence $n$, you can form the Lagrange polynomials $L_i(x)$ with $i$ running from $1$ to $n$. They have the property that $L_i(x)=\delta_{ix}$, the Kroenecker delta, $1$ if $i=x$ and $0$ if $x$ is a natural in the range $[1,n]$. Then if your sequence is $a_i$, the function is $\sum a_i L_i(x)$
If you don't need the function defined except at the naturals in $[1,n]$ like your program example, you can just use $f(j)=\sum a_i \delta_{ij}$