Skip to main content
1 of 3
Neil
  • 177.2k
  • 12
  • 74
  • 281

Charcoal, 40 bytes

Nθ≔¹ηW¬№υθ«≦⊕η≔∨υ⟦⁰⟧ζ≔⟦⟧υF⊕θFζ⊞υ⁺λXκη»Iη

Try it online! Link is to verbose version of code. Outputs the nth value. Brute force, so times out on TIO for n=23 and similar higher values. Explanation:

Nθ

Input n.

≔¹η

Start searching for powers.

W¬№υθ«

Repeat until a one of the sums includes the input.

≦⊕η

Try the next power.

≔∨υ⟦⁰⟧ζ

Save the previous set of sums, or use a sum of zero for the first pass (this is needed to make the code output 2 for an input of zero instead of the 1 that an empty sum would imply.)

≔⟦⟧υ

Start a new set of sums.

F⊕θ

Loop over all of the integers up to and including n.

Fζ

Loop over all of the previous sums.

⊞υ⁺λXκη

Add the current power to the previous sum and save the result.

»Iη

Output the highest power needed.

Neil
  • 177.2k
  • 12
  • 74
  • 281