--> function aliquot(atom n) sequence s = {n} integer k if n=0 then return {"terminating",{0}} end if while length(s)<16 and n<140737488355328 do n = sum(factors(n,-1)) k = find(n,s) if k then if k=1 then if length(s)=1 then return {"perfect",s} elsif length(s)=2 then return {"amicable",s} end if return {"sociable",s} elsif k=length(s) then return {"aspiring",s} end if return {"cyclic",append(s,n)} elsif n=0 then return {"terminating",s} end if s = append(s,n) end while return {"non-terminating",s} end function constant n = tagset(12)&{28, 496, 220, 1184, 12496, 1264460, 790, 909, 562, 1064, 1488, 15355717786080} for i=1 to length(n) do {string classification, sequence dseq} = aliquot(n[i]) dseq = join(apply(true,sprintf,{{"%d"},dseq}),",") printf(1,"%14d => %15s, {%s}\n",{n[i],classification,dseq}) end for