big = 1 000 000 s = 0 S = Set([]) unseen = 1 seen(v) = if (v < big, bit test(s, v), set search(S, v)) see(v) = if (v < big, s = bit or(s, 2^v), S = set union(S, Set([v]))); while (seen(unseen), unseen++) A287170(n) = my (v=0); while (n>1, v++; forprime(p=factor(n)[1,1], oo, my (x=valuation(n,p)); if (x,n\=p^x,break))); v other(p) = { for (v=unseen, oo, if (!seen(v) && A287170(p*v) >= 4, see(v); return (v); ); ); } for (n=1, 25 000, print (n " " other(n))) quit