Posted by haifeng on 2011-08-10 16:44:13 last update 2011-08-13 10:18:58 | Answers (0) | 收藏
// prints all amicable numbers up to 100000
d:=func < m | DivisorSigma(1,m)-m >;
for m:=2 to 100000 do
n:=d(m);
if m ge n and d(n) eq m then
print m, n;
end if;
end for;