Starting with 1, output the sequence of integers which cannot be represented as the sum of powers of earlier terms. Each previous term can be used at most once, and the exponents must be non-negative integers.
This sequence starts:
1, 2, 6, 12, 25, 85, 194, 590, 1695, 4879, 19077, 83994, 167988
For example, after 1 and 2:
- \$ 3 = 1^1 + 2^1 \$, so 3 is not in the sequence
- \$ 4 = 2^2 \$, so 4 is not in the sequence
- \$ 5 = 1^1 + 2^2 \$, so 5 is not in the sequence
- \$ 6 \$ cannot be represented in this way, so 6 is in the sequence
- etc.
The powers can also be 0; for example, \$ 24 = 1^1+2^4+6^1+12^0 \$, so 24 is not in the sequence.
This is OEIS A034875.
Rules
- As with standard sequence challenges, you may choose to either:
- Take an input
n
and output then
th term of the sequence - Take an input
n
and output the firstn
terms - Output the sequence indefinitely, e.g. using a generator
- Take an input
- You may use 0- or 1-indexing
- You may use any standard I/O method
- Standard loopholes are forbidden
- This is code-golf, so the shortest code in bytes wins
[12, 6, 2, 1]
for \$n = 4\$)? \$\endgroup\$