<s>[INST] $(n^1+n)/2$ sequence This is going to be hard to explain so I'll just give an example
Let's say we have a standard arithmetic sequence that goes up by 1 each time
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
The last number (in this case, 10) is n
Scenario z:
Pick 2 numbers in the sequence and multiply them. The product should be equal to the rest of the numbers added together. For example, 6 and 7 (let's call 6 and 7 x and y for now) are between 1 and 10 and if multiplied together, we get 42. Add 1+2+3+4+5+8+9+10 (don't count the numbers that were multiplied together) and we also get 42.
n can only be an integer, no decimals involved here.
x and y has to be an integer between 0 and and n, and x cannot be equal to y
The question is, is there a mathematical way for figuring out the different numbers that can represent n that satisfies scenario z? And if n does satisfy the given scenario, is there a way to figure out x and y without having to try every possible combination?
$n^2+1$ numbers seems to always work (10, 17, 26, 37 etc), and I have no clue why.
I know I explained this pretty badly, feel free to ask any questions regarding this.
 [/INST] $\left(n^2 + n + 2\right) \times \left(n^2 - n + 1\right) = 
n^4 + 2n^2 - n + 2.$
Therefore
$$\left[\frac{n^4 + 3n^2 + 2}{2} - \frac{n^2 + n}{2}\right] \div \frac{n^2 + n + 2}{2} = (n^2 - n + 1).$$
$$S = \sum_{i=1}^{n^2 + 1} i = \frac{(n^2 + 1)(n^2 + 2)}{2} = \frac{n^4 + 3n^2 + 2}{2}.$$
So, for a particular value of $n$, you take $~\displaystyle y = \sum_{i=1}^n i = \frac{n^2 + n}{2}.$
Then,
$$\frac{S - y}{y+1} = \frac{n^4 + 2n^2 - n + 2}{n^2 + n + 2} = n^2 - n + 1.$$
Taking $n^2 - n + 1 = z$ you have that
$\displaystyle \frac{S - y}{y+1} = z \implies 
S - y = yz + z \implies S = y + z + yz.$
Note that both $~\displaystyle y = \frac{n^2 + n}{2}$ and $z = (n^2 - n + 1)$
will be elements in $\{1,2,\cdots, (n^2 + 1)\}.$
</s>