JavaScript (Node.js), 63 bytes
f=(n,m=2,i=0,p=n-i**m)=>p<0?f(n,m+1):!p||i&&f(p)<m?m:f(n,m,i+1)
Time out for not so large n as its terrible recursion design. It could be fast if we apply memorize to it (70 bytes).
f=(n,m=2,i=0,p=n-i**m)=>f[n]??=p<0?f(n,m+1):!p||i&&f(p)<m?m:f(n,m,i+1)
for (i = 0; i < 1000; i+= 20) {
o.value +== [...Array(2050000)].map((_, ji) => (f(i + j).filter(v +=> '').padStartf(2v) > 5).join('') +', '\n';
}')
<output id=o<a style=white-spacehref="https:pre><//oeis.org/A111151">A111151</a>: <output id=o></output>