Sequence patterns Hi I'm new and I was wondering if a pattern could be derived from this. I wrote a program which printed all the numbers up until a number the user inputted, and then continuously deleted the middle number until none where left. I noticed a pattern in the totals and differences and was wondering if there are more. I would be delighted if one could be found: Here is an example with the inputted number being 10:
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']          Total: 55 ,  ...
['1', '2', '3', '4', '5', '7', '8', '9', '10']          Total: 49 , Difference: 6
['1', '2', '3', '4', '7', '8', '9', '10']          Total: 44 , Difference: 5
['1', '2', '3', '4', '8', '9', '10']          Total: 37 , Difference: 7
['1', '2', '3', '8', '9', '10']          Total: 33 , Difference: 4
['1', '2', '3', '9', '10']          Total: 25 , Difference: 8
['1', '2', '9', '10']          Total: 22 , Difference: 3
['1', '2', '10']          Total: 13 , Difference: 9
['1', '10']          Total: 11 , Difference: 2
['1']          Total: 1 , Difference: 10
[]          Total: 0 , Difference: 1

 A: Let us denote the rows with an index $i \in \{ 0,1,2,\dots,n\} $. The row with $i=0$ is the "full row", the one with $i=n$ is the "empty row".
Note that the $i$-th row has $n-i $ elements, i.e. it is obtained by deleting exactly $i$ elements from $\{1,2,\dots,n\}$.
Consider the $i$-th row. Let $k$ denote the highest deleted number and $j$ the highest number in the first half of the row (the one such that $j+1$ is the lowest deleted number). We have $j=k-1$.
With this notation, the $i$-th has the form
$$ \{1,2,\dots,j, ' ', ' ', \dots, ' ', k+1, \dots, n \}. $$
Now we write $k$ in terms of $n$ and $i$.


*

*If $n$ is even, we have $ k = \frac{n}{2} + \lfloor \frac{i+1}{2} \rfloor $.

*If $n$ is odd, we have $ k = \frac{n}{2} + \lfloor \frac{i+1}{2} \rfloor  - \frac{1}{2}$.
Together, we have
$$  k = \lfloor \frac{n}{2} + \lfloor \frac{i+1}{2} \rfloor \rfloor. $$
Therefore
$$ j = k-i = \lfloor \frac{n}{2} + \lfloor \frac{1-i}{2} \rfloor \rfloor. $$
Now, the sum $S_i$ of the $i$-th row is
$$ S_i = \frac{n (n+1)}{2} - \left( (j+1) + (j+2) + \cdots + (j+i) \right) = \\
= \frac{n (n+1)}{2} - i j - \frac{i (i+1)}{2} = \\
= \frac{n (n+1)}{2} - \frac{i (i+1)}{2} - i (k-i) = \\
=  \frac{n (n+1)}{2} - \frac{i (i+1)}{2} - i \lfloor \frac{n}{2} + \lfloor \frac{1-i}{2} \rfloor \rfloor.   $$
Now we can find the $i$-th difference, $ 0<i \leq n$, that is
$$ d_i = S_{i-1} - S_{i} =  (i-1) \lceil \frac{i}{2} \rceil + i \lfloor \frac{1-i}{2} \rfloor + \lfloor \frac{n}{2} \rfloor + 1. $$
As expected,
$$ d_i - d_{i-1} = (-1)^{i-1} (i-1). $$
