If you really want to express it as a sequence formula, apart from the generic formulas based on the prime counting function and some conjectures regarding the calculation of the gaps that can be found, as explained in the answer by k1next, at OEIS, there was a recent question asking for a formula for primes that can be also applied to this question to get something closer to the prime gap function. It has not practical value, but it is a valid formulation.
There is an example of a formula of the prime counting function based on Wilson's theorem, and the formula is true only if:
$\forall j\gt0:\displaystyle f(j)=\frac{\sin^2\left(\pi\frac{(j-1)!^2}{j}\right)}{\sin^2\left(\frac{\pi}{j}\right)}$ has value $1$ when $j$ is prime and $0$ in the rest of cases.
Thus we could construct a formula for primes like this:
$$\forall j\gt0:\displaystyle f(j)=\frac{\sin^2\left(\pi\frac{(j-1)!^2}{j}\right)}{\sin^2\left(\frac{\pi}{j}\right)} \cdot j$$
So if we run a loop it should provide the list of primes and $0$'s as follows:
$$(j\ge1)\ [1,2,3,4,5,6,7,8,9,10,11...] \to (j\ge1)\ [0,2,3,0,5,0,7,0,0,0,11...](*)$$
So if we want to obtain the gaps, we can define a conditional formula as follows:
$$\forall j \ge 3: g_{j} = \begin{cases} 0 & \text{if $f(j)=0$} \\
\\ f(j)-f(i) & \text{if $f(j) \gt 0 , i\lt j, f(i) \gt 0 \land \not\exists k : f(i) \lt f(k) \lt f(j)$} \end{cases}$$
It should provide a list of prime gaps and $0$'s:
$$(*)(j\ge1)\ [0,2,3,0,5,0,7,0,0,0,11...] \to (j \ge 3)\ [1,0,2,0,2,0,0,0,4...]$$