I am trying to find a common formula for length of sequence (meaning number $N$ of elements) of real numbers equally spaced at distance $R$ from some starting value $a$ (including this value) and up to some ending value $L$ so that:
$$ a \leq x(n) \leq L $$ and
$$ x(n) - x(n - 1) = R $$
Here first element of the sequence is $x_1 = a$, and $L$ may not be included in the finite sequence $x(n)$, so it can be that $x_N < L$. Additionally, $R > 1$ and $a < L$.
In case when $a = 1$ and $L$ and $R$ are integers, the formula for number of elements $N$ of sequence $x(n)$ will be:
$$ N = \lceil L / R \rceil $$
Here $\lceil u \rceil$ means "ceil" function: an integer number not less than $u$. But for an arbitrary $a$ it is not as obvious. It looks like the formula should look like
$$ N = \lceil \left( L - (a - 1)\right) / R \rceil $$
but I can't prove it. Is this formula correct?
You cannot determine it precisely until you have specified at what $n$ the sequence starts and ends: do you define $x_0 = a$ or do you start at $x_1 = a$? The end point is less ambiguous: $ x_N = L$. Assuming that you start at $n = 0$, the length of the interval is $L - a$ and there are $N$ steps, each of length R, so $N \cdot R = L - a$. If you start at $n=1$, there are $N-1$ steps, so $(N - 1) \cdot R = L - a$.