So I'm dealing with this problem that has to do with arithmetic sequences and I was wondering if I could write the general term of this kind of sequences (finite) like $$a_{k-1}=a_1+(k-\lfloor \frac{n}2 \rfloor)d$$ where $k$ can take values from $2$ to $n+1$
$\lfloor \rfloor$ is the floor function and d is the common difference
For example, if we take the sequence $1,4,7,10,13$.
In this case $n=5$ and $d=a_n-a_{n-1}=3$
From the formula above for $k=2$ $$a_1=1+3(2-\lfloor \frac{5}2 \rfloor)=1$$ $k=3$ $$a_2=1+3(3-\lfloor \frac{5}2 \rfloor)=4$$
$k=4$ $$a_3=1+3(4-\lfloor \frac{5}2 \rfloor)=7$$
$k=5$ $$a_4=1+3(5-\lfloor \frac{5}2 \rfloor)=10$$
$k=6$ $$a_5=1+3(6-\lfloor \frac{5}2 \rfloor)=13$$
If you really want to, you can, but $n$ isn't a free parameter. If you want the formula $$ a_{k-1} = a_1 + (k-\lfloor \frac{n}{2}\rfloor)d $$ to hold for $k=2$, you get a condition $$ a_1 = a_1 + (2-\lfloor \frac{n}{2}\rfloor)d$$ that means that for $d\neq 0$ you'll need $$\lfloor \frac{n}{2}\rfloor = 2$$ So, for natural $n$ it's only correct for $n=4$ and $n=5$ (like in your example). The formula simplifies then to the usual $$ a_{k-1} = a_1 + (k-2)d $$ $$ a_k = a_1 + (k-1) d $$
What may be of more use to you are the formulae $$ a_{k} = a_{\lfloor \frac{n}{2}\rfloor} + (k-\lfloor \frac{n}{2}\rfloor)d $$ or $$ a_{k-1} = a_{\lfloor \frac{n}{2}\rfloor-1} + (k-\lfloor \frac{n}{2}\rfloor)d $$ that are also variations on the general formula, but allow you to use an arbitrary $n$.