Jump to content

Proper divisors: Difference between revisions

Line 3,694:
=={{header|langur}}==
{{trans|Go}}
<syntaxhighlight lang="langur">val .getproper = fn( .x) {: for[=[]] .i of .x \ 2 { if .x div .i: _for ~= [.i] } }
val .cntproper = fn( .x) {: for[=0] .i of .x \ 2 { if .x div .i: _for += 1 } }
 
val .listproper = fn(.x) {
if .x < 1: return null
for[=""] .i of .x {
_for ~= $"\{{.i:2;}} -> \{{.getproper(.i);}}\n"
}
}
Line 3,718:
}
 
writeln $"The following number(s) <= 20000 have the most proper divisors (\{{.max;}})"
writeln .most</syntaxhighlight>
</syntaxhighlight>
 
{{out}}
1,006

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.