upto(n) = {res = List(); data = List(); for(i = 1, n, if(isprimitive(i), listput(data, i) ) ); for(i = 1, #data - 1, for(j = i+1, #data, l1 = lcm(data[i], data[j]); for(m = 1, n\l1, listput(res, l1*m) ) ) ); listsort(res, 1); res } isprimitive(n) = {if(sigma(n) < 2*n, return(0)); my(f = factor(n)[,1]); for(i = 1, #f~, if(sigma(n/f[i]) >= 2*n/f[i], return(0)) ); 1 }