\\ A350674 greedy(n,e) = { my (g=[], r); while (n, r=sqrtnint(n,e); n-=r^e; g=concat(g,[r]); ); g } T(n,k,e=2) = { n=greedy(n,e); k=greedy(k,e); my (i=1, j=1, v=0); while (i<=#n && j<=#k, if (n[i]==k[j], v+=n[i]^e; i++; j++, n[i]