Amicable pairs: Difference between revisions

Content deleted Content added
Drkameleon (talk | contribs)
Undo revision 324465 by Drkameleon (talk)
Drkameleon (talk | contribs)
added Arturo
Line 316:
<lang AppleScript>{{220, 284}, {1184, 1210}, {2620, 2924}, {5020, 5564},
{6232, 6368}, {10744, 10856}, {12285, 14595}, {17296, 18416}}</lang>
 
=={{header|Arturo}}==
<lang rebol>properDivs: function [x] ->
(factors x) -- x
 
amicable: function [x][
y: sum properDivs x
if and? x = sum properDivs y
x <> y
-> return @[x,y]
return ø
]
 
amicables: []
 
loop 1..20000 'n [
am: amicable n
if am <> ø
-> 'amicables ++ @[sort am]
]
 
print unique amicables</lang>
 
{{out}}
 
<pre>[220 284] [1184 1210] [2620 2924] [5020 5564] [6232 6368] [10744 10856] [12285 14595] [17296 18416]</pre>
 
=={{header|ATS}}==