Counting sequences Given 2 positive integers $a_1$ and $a_n$, in how many ways can we 'complete' the sequence to form a sequence of integers $a_1,a_{2},\dots,a_n$ such that $\forall i$ with $1 < i \leq n$ we have $1\leq a_i \leq a_{i-1} +1$.
That is, each term is positive and at most one larger than the previous term.
It is easy to see that if $a_n = a_1+n-1$ there is only one such sequence. given by $a_{i+1} = a_i+1$.
If $a_1 = a_n = 1$ the answer is given by the catalan numbers.
Is there a general formula or a generating function that solves this counting problem?
EXAMPLE: for $a_1 = a_3 = 2$ there are $3$ possible sequences, $2,3,2$ and $2,2,2$ and $2,1,2$.

I’m going to make a couple of minor changes for convenience. I’m going to use non-negative rather than strictly positive integers, and I’m going to let the first term be $a_0$, rather than $a_1$. Finally, for now at least I’m going to assume that $a_0=0$, so this will only be a partial answer. (I shouldn’t be at all surprised if the same ideas can be pushed further, but I’ve not yet had a chance to think seriously about the possibility.)
Let $\alpha=\langle a_0,\ldots,a_n\rangle$ be a sequence of non-negative integers such that $a_0=0$ and $a_{k+1}\le a_k+1$ for $0\le k<n$, and let $d=a_n$. For $k=0,\ldots,n-1$ let $b_k=a_k-a_{k+1}+1\ge 0$. For $k=0,\ldots,n-1$ let 
$$\alpha_k=\langle 1,\underbrace{-1,\ldots,-1}_{b_k}\rangle\;,$$
and let $\widehat\alpha$ be the concatenation $\alpha_0\alpha_1\ldots\alpha_{n-1}$. For each $m<n$ the sum of the terms of $\alpha_0\ldots\alpha_m$ is
$$m+1-\sum_{k=0}^m(a_k-a_{k+1}+1)=m+1-(a_0-a_m+m+1)=a_m\;,$$
so the sum of the terms of $\widehat\alpha$ is $d$, and all partial sums are non-negative. It’s not hard to check that this procedure is reversible: given a sequence $\sigma$ of $n$ ones and $n-d$ negative ones whose partial sums are all non-negative, we can reconstruct a sequence $\alpha=\langle a_0,\ldots,a_n\rangle$ of non-negative integers such that $a_0=0$, $a_{k+1}\le a_k+1$ for $k=0,\ldots,n-1$, $a_n=d$, and $\widehat\alpha=\sigma$. Thus, the number of such sequences $\alpha$ is the number of sequences of $n$ ones and $n-d$ negative ones whose partial sums are all non-negative. I claim that this is
$$\frac{d+1}{n+1}\binom{2n-d}n$$
(which is indeed the Catalan number $C_n$ when $d=0$). This is immediate from the following result in D.F. Bailey, ‘Counting Arrangements of $1$’s and $-1$’s’ (PDF), Mathematics Magazine, Vol. $69$, No. $2$, April $1996$, $128$-$131$: just set $k=n-d$.

Theorem. If $n\ge k\ge 2$, the number of sequences of $n$ ones and $k$ negative ones with all partial sums non-negative is $$\frac{(n+1-k)(n+k)^{\underline{k-1}}}{k!}=\frac{n+1-k}{n+1}\cdot\frac{(n+k)^{\underline k}}{k!}=\frac{n+1-k}{n+1}\binom{n+k}n\;.$$

Here $x^{\underline k}$ is the falling factorial. 
In the language and notation of the original question, there are 
$$\frac{a_n}n\binom{2n-a_n-1}{n-1}$$
sequences $\langle a_1,\ldots,a_n\rangle$ of positive integers such that $a_{k+1}\le a_k+1$ for $k=1,\ldots,n-1$, and $a_1=1$.
Bailey develops general properties of what he writes as $n\brace k$, the number of sequences of $n$ ones and $k$ negative ones with all partial sums non-negative; his result can also be obtained using a generalization of Raney’s lemma.
