%p with(numtheory); P:=proc(i) local b,c,j,s,n; for n from 2 by 1 to i do b:=(convert(ifactors(n),`+`)-1); c:=nops(b); j:=0; s:=0; for j from c by -1 to 1 do s:=s+convert(b[j],`*`); od; if n=sigma(n)-s-1 then print(n); fi; od; end: P(500);