# [Charcoal], <s>40</s> 39 bytes

    FN⊞υ⊗¬ιF…²χF⮌⌕Aυ⁰F⊙υΣ✂…υ⊕⁻κXμι±¹§≔υκιIυ

[Try it online!][TIO-kwxcgmzu] Link is to verbose version of code. Outputs the first `n` values. Explanation:

    FN⊞υ⊗¬ι

Start with `0` having been found to have a value of `2` but none of the other values having been found yet.

    F…²χ

Try from squares up to ninth powers.

    F⮌⌕Aυ⁰

Loop over all of the values that haven't yet been found in reverse order, so the highest index is tested first.

    F⊙υΣ✂…υ⊕⁻κXμι±¹

Subtract the powers of all the integers up to `n` from the current index and see if any of those values had previously been found. This is harder than it sounds as it's necessary to defeat Charcoal's cyclic indexing.

    §≔υκι

If so then mark this value with the necessary power.

    Iυ

Output all of the values.

[Charcoal]: https://github.com/somebody1234/Charcoal
[TIO-kwxcgmzu]: https://tio.run/##LY7NCsIwEITvPkWOG4iggidPpSL0YCn2CWK6tsF0I/lR@/QxUY/7zczOqEk6ZaVJ6WYdg4YeMbRxvqIDzlkX/QRRsKONV4MDtDaA5pwfVl/3RdKIsBNsu8nmH8InOo9w0jRUxpRw1v5iRUsBfZyhN1oh1IsyWE/2UXBDyuGMFHLRWVP0cBess688ZRas1HLBWhxlQNiWi7PKez1SFRoa8F1@3IvxsOqcpgC19AFiXpvSbp/WT/MB "Charcoal – Try It Online"