first(n) = { qp = 0; pp = 0; forprime(p = 2, oo, pp*=p; if(pp > n, break ); pp++ ); v = vector(pp); res = vector(n); for(i = 2, n, o = omega(i); s = 1 + sum(j = 1, o-1, v[j]); res[i] = s; v[o]++; ); res }