pp = []; { [i,j] = [4,4]; \\ i <= j lim = 47157914257; for (a=1, oo, ai = a^i; if (ai>lim, break); for (b=if (i==j, a, 1), oo, p = ai + b^j; if (p>lim, break, isprime(p), pp = concat(pp, [p]); ); ); ); apply(p -> for (a=1, oo, if (ispower(p-a^i, j), print (n++ " " a); break; ); ) , Set(pp)); } quit