How to find the exact spacing to "hit" three known numbers in a linear series This is relatively simple but I've been out of college for a bit and can't quite get the result I'm looking for no matter how I attack this and I'm sure I'm just forgetting a crucial concept that is the missing link.
What I want to know is how to solve for the exact deviation required so that a linear sequence can be formed using three numbers while ensuring that the spacing between each value in the sequence is constant. The first and last value in the sequence are always known, while the third number can fall anywhere in-between, and the sequence will always be ascending. This needs to be precise enough to work for non-integers as well.
For example, lets say the first number is 2.5, the last number is 13, and the number in the middle that I want to use as the target point is  7, which looks like:
Start of 2.5, end of 13, and target value of 7
I essentially just want to know what dx is in the previous image. For this basic example it isn't too hard to figure out that dx = 1.5 which forms the sequence:
{ 2.5, 4, 5.5, 7, 8.5, 10, 11.5, 13 }

and includes the extent (first and last) and target numbers as I require. Now obviously this problem will have an infinite number of solutions that will form their own series, as once you find the largest spacing required, you can always break up that spacing into fractions that are themselves evenly spaced. In this same example I could break the largest deviation required, 1.5, into thirds and end up with:
Largest spacing required split into thirds
where dx_1 = dx_2 = dx_3 = 0.5 and dx_1 + dx_2 + dx_3 = dx, forming the sequence:
{ 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, ... 12, 12.5, 13 }

which still satisfies my requirements, now just with a finer granularity.
So, I know that the solution will be some kind of series composed of the formula for the largest spacing required combined with a scalar n applied to the denominator, where n is any positive integer, and n = 1 will produce the equation for the largest deviation possible, while larger values of n will give equations with rational fractions of dx that produce a more finely spaced sequence when solved and applied.
Basically, I just need the general solution to the above example. A bonus would be a quick way to know how large of a sequence (number of values) will be formed by using this spacing, though I expect that will just require some simple algebraic rearrangement of the solution I described once I know it.
Thanks.
 A: With values $a<b<c$, you need to express $\frac{b-a}{c-a}$ as a fraction $\frac nm$ in shortest terms. Then your $dx$ will be $\frac{c-a}{m}$ (and $b$ is reached from $a$ after $n$ steps of $m$ steps in total). 
For example, with $a=2.5$, $b=7$, $c=13$, you have $\frac{b-a}{c-a}=\frac{7-2.5}{13-2.5}=\frac{4.5}{10.5}=\frac 37$, so we take $dx=\frac{13-2.5}7=1.5$

Some problems may arise if all numbers are only given as approximate values with fininte precision. In that case you may be satisfied if the exact fraction $\frac nm$ is only a (sufficiently good) approximation of $\frac{b-a}{c-a}$ (say, if in the above example rounding errors might lead to a perfect solution $\frac{30000001}{70000001}$ then would certainly prefer the hardly different but much simpler $\frac 37$). At this point, continued fractions come into play and help finding suitable approximation.
For example, you compute (using limited precision) $\frac{4.5}{10.5}\approx 0.42857$.
We find
$$0.42857\approx\underbrace{ 0+\frac1{2.33334}}_{\approx\frac 01}\approx \underbrace{0+\frac1{2+\frac1{2.99994}}}_{\approx \frac12}\approx \underbrace{0+\frac1{2+\frac1{2+\frac1{1.00006}}}}_{\approx \frac1{2+\frac12}=\frac25}\approx\underbrace{0+\frac1{2+\frac1{2+\frac1{1+\frac1{16666}}}}}_{\approx \frac1{2+\frac1{2+\frac11}}=\frac37} $$
and the "correct" fraction $\frac37$ appears right before we are taken to inappropriately large numerators and denominators.
A: I assume you are interested in solutions where the terms are rational numbers.
So suppose $x< y < z$ are rational numbers, and we wish to find a sequence with constant (rational) spacing that contains these numbers.
The idea is to look at the positive (rational) numbers $y-x$ and $z-y$ and find a rational number, call it $w$, such that $w$ divides both of the aforementioned numbers. That is, $nw = y-x$ and $mw = z-y$ for whole numbers $n$ and $m$. Then if the spacing is $w$, we are done. For if we start our sequence at $x$, the next term is $x+w$, the term after is $x+2w$, $\ldots$ , and eventually, we hit $x+nw = x+(y-x) = y$ (after $n$ steps), and at some point we also get $x+(n+m)w = (x+nw) + mw = y + mw = y + (z-y) = z$ (after $n+m$ steps, or equivalently, after $m$ steps from $y$).
How do we find the largest spacing? Note that $w = \frac{y-x}{n} = \frac{z-y}{m}$, so $\frac{m}{n} = \frac{z-y}{y-x}$. Now since $z-y$ and $y-x$ are themselves rational, we know that $\frac{m}{n}$ will be rational too. In fact, if we bring $\frac{z-y}{y-x}$ to its reduced fraction form, we will have the smallest possible values of $m$ and $n$ (the reduced fraction numerator and denominator, respectively). So the $w$ we compute is guaranteed to be the smallest spacing such that we 'hit' all three numbers. (Mini-exercise: why?)
A: Let $a,b,m \in \mathbb{R}$ be your initial, final, and intermediate values, and let the distance of each spacing be $d \in  \mathbb{R}_{>0}$. Paraphrasing the  question, you want the sequence 
$$
x_n = a+nd \quad(n \geq0)
$$
such that $x_k = m, x_l = b$ for some $k < l$. If there exists such $l$, we would have
$$
b = a +ld
$$
so $d = \frac{b-a}{l}$. Likewise for $k$, we would need $d = \frac{m-a}{k}$. This gives the following equation:
$$
\frac{b-a}{l} = \frac{m-a}{k}
$$
and rewriting, $l = k\frac{b-a}{m-a}$ so in particular for an exact solution we would need $\frac{b-a}{m-a} \in \mathbb{Q}$. If that can be guaranteed, let $k \in \mathbb{N}$ such that $l = k\frac{b-a}{m-a}$ is a natural number, and let $d = \frac{b-a}{l}$. 
In your example, if $a = 2.5,  b = 13, m = 7$, $\frac{b-a}{m-a} = \frac{7}{3}$. Hence we can take $k =3$, thus $l = 7$ and $d = \frac{13-2.5}{7} = 1.5$.
