If you have 100 numbers (1 - 100, including 1 and 100) and you choose 2 of them then do the formula x + y + xy (x being the first number and y being the second) and you replace the 2 numbers chosen with that new number, what are the last possible values for the last number?

example on a smaller scale:
1, 2

1 + 2 + 2 = 5
x + y + xy

The possible values for the last number is 5.

I've gotten around the fact that this is probably a combination problem but I'm lost as to how to start this problem.

To solve this problem, we can start by listing out the possible values for the last number obtained by applying the formula x + y + xy. Let's break down the problem into steps:

Step 1: Generate all the possible pairs of numbers from 1-100, which can be achieved by using nested loops.

Step 2: For each pair of numbers (x, y), calculate the value of x + y + xy using the formula.

Step 3: Replace the pair (x, y) with the obtained result.

Step 4: Repeat steps 2 and 3 until we have only one number left.

Note: At each step, the number of available values reduces by 1 because we are combining two numbers into one.

Here's a possible solution in Python:

```python
numbers = list(range(1, 101)) # Generate the list of numbers from 1 to 100
while len(numbers) > 1:
new_numbers = []
for i in range(len(numbers)//2): # Process pairs of numbers
x = numbers[2*i]
y = numbers[2*i+1]
result = x + y + x*y
new_numbers.append(result)
if len(numbers) % 2 == 1: # If there is an odd number of numbers, keep the last one
new_numbers.append(numbers[-1])

numbers = new_numbers

print(numbers[0]) # Print the final number
```

When you run the code, it will output the last possible value for the last number that remains after repeatedly applying the formula.

Please note that this is just one way to approach this problem. There might be other methods or optimizations depending on the programming language you choose or any additional constraints you may have.