Proper divisors: Difference between revisions

no edit summary
(Add Rust implementation)
No edit summary
Line 3,357:
return a b /*return the divisors (both lists). */</lang>
'''output''' &nbsp; is identical to the 2<sup>nd</sup> REXX version. <br><br>
 
=={{header|Ring}}==
<lang ring>
# Project : Proper divisors
# Date : 2017/09/22
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
 
limit = 10
for n=1 to limit
if n=1
see "" + 1 + " -> (None)" + nl
loop
ok
see "" + n + " -> "
for m=1 to limit - 1
if n%m = 0
see " " + m
ok
next
see nl
next
</lang>
Output:
<pre>
1 -> (None)
2 -> 1 2
3 -> 1 3
4 -> 1 2 4
5 -> 1 5
6 -> 1 2 3 6
7 -> 1 7
8 -> 1 2 4 8
9 -> 1 3 9
10 -> 1 2 5
</pre>
 
=={{header|Ruby}}==
2,468

edits