Proper divisors: Difference between revisions

Content added Content deleted
Line 3,694: Line 3,694:
=={{header|langur}}==
=={{header|langur}}==
{{trans|Go}}
{{trans|Go}}
<syntaxhighlight lang="langur">val .getproper = fn(.x) { for[=[]] .i of .x \ 2 { if .x div .i: _for ~= [.i] } }
<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 .cntproper = fn .x: for[=0] .i of .x \ 2 { if .x div .i: _for += 1 }


val .listproper = fn(.x) {
val .listproper = fn(.x) {
if .x < 1: return null
if .x < 1: return null
for[=""] .i of .x {
for[=""] .i of .x {
_for ~= $"\.i:2; -> \.getproper(.i);\n"
_for ~= "{{.i:2}} -> {{.getproper(.i)}}\n"
}
}
}
}
Line 3,718: Line 3,718:
}
}


writeln $"The following number(s) <= 20000 have the most proper divisors (\.max;)"
writeln "The following number(s) <= 20000 have the most proper divisors ({{.max}})"
writeln .most</syntaxhighlight>
writeln .most
</syntaxhighlight>


{{out}}
{{out}}