Proper divisors: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
(Added Easylang) |
||
Line 2,242: | Line 2,242: | ||
10: [1, 2, 5] |
10: [1, 2, 5] |
||
15120: 79</pre> |
15120: 79</pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight> |
|||
proc propdivs n . divs[] . |
|||
divs[] = [ ] |
|||
if n < 2 |
|||
return |
|||
. |
|||
divs[] &= 1 |
|||
sqr = sqrt n |
|||
for d = 2 to sqr |
|||
if n mod d = 0 |
|||
divs[] &= d |
|||
if d <> sqr |
|||
divs[] &= n / d |
|||
. |
|||
. |
|||
. |
|||
. |
|||
for i to 10 |
|||
propdivs i d[] |
|||
write i & ":" |
|||
print d[] |
|||
. |
|||
for i to 20000 |
|||
propdivs i d[] |
|||
if len d[] > max |
|||
max = len d[] |
|||
maxi = i |
|||
. |
|||
. |
|||
print maxi & " has " & max & " proper divisors." |
|||
</syntaxhighlight> |
|||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |