The sequence starts with 2, 4, and 8. Afterwards, the following rules are applied iteratively:
- Identify the last number added to the sequence; let’s call it “base”.
- For every second number in the sequence that is less than the base, add the base to each of these numbers and append the sums to the sequence.
- After doing that for all eligible numbers, double the base and append this new number to the sequence.
- Repeat steps 1-3 with the new base (the last number added), until the sequence is as long as desired.
So for example, if we start with 2, 4, 8:
- The base is 8, and every second number less than 8 is 4.
- Adding 8 to 4 and appending the result gives 2, 4, 8, 12.
- Doubling 8 and appending the result gives 2, 4, 8, 12, 16.
- The new base is 16, and every second number less than 16 is 4 and 12.
- Adding 16 to these numbers and appending the results gives 2, 4, 8, 12, 16, 20, 28.
- Doubling 16 and appending the result gives 2, 4, 8, 12, 16, 20, 28, 32.
- And so on.
This should generate the sequence as you’ve described it.
2, 4, 8, 12, 16, 20, 28, 32, 36, 44, 52, 64, 68, 76, 84, 96, 108, 128, 132, 140, 148, 160