upto(n) = { ulim = n; qchecks = 0; res = List(); process([1, 1, 1]); listsort(res, 1); print(qchecks); res } process(v) = {my(p, e, np); qchecks++; if(ispowerful(sigma(v[1])), print1(v[1]", "); listput(res, v[1])); np = nextprime(v[2] + 1); for(e = 2, logint(ulim \ v[1], 2), forprime(p = np, sqrtnint(ulim \ v[1], e), process([v[1]*p^e, p]) ) ) } \\ispowerful(n) = my(f = factor(n)); vecmin(f[, 2]) > 1