Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
|
||||
function flat_d(sequence s)
|
||||
for i=1 to length(s) do s[i] = sprintf("%d",s[i]) end for
|
||||
return join(s,",")
|
||||
end function
|
||||
|
||||
constant n = tagset(12)&{28, 496, 220, 1184, 12496, 1264460, 790, 909, 562, 1064, 1488, 15355717786080}
|
||||
sequence class, dseq
|
||||
for i=1 to length(n) do
|
||||
{class, dseq} = aliquot(n[i])
|
||||
printf(1,"%14d => %15s, {%s}\n",{n[i],class,flat_d(dseq)})
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue