Ruth-Aaron numbers: Difference between revisions

Added Easylang
(Add Mathematica/Wolfram Language implementation)
(Added Easylang)
 
Line 430:
Elapsed Time: 5.991 Sec.
 
</pre>
 
=={{header|EasyLang}}==
{{trans|FreeBASIC}}
<syntaxhighlight>
func divsum n alldiv .
f = 2
repeat
q = n / f
if n mod f = 0
if alldiv = 1
s1 += f
else
if f <> f0
s1 += f
f0 = f
.
.
n = q
else
f += 1
.
until f > n
.
return s1
.
proc ruth_aaron alldiv . .
n = 2
repeat
s = divsum n alldiv
if s = s0
write n - 1 & " "
c += 1
.
s0 = s
n += 1
until c >= 30
.
.
print "first 30 ruth-aaron numbers (factors):"
ruth_aaron 1
print ""
print ""
print "first 30 ruth-aaron numbers (divisors):"
ruth_aaron 0
</syntaxhighlight>
{{out}}
<pre>
first 30 ruth-aaron numbers (factors):
5 8 15 77 125 714 948 1330 1520 1862 2491 3248 4185 4191 5405 5560 5959 6867 8280 8463 10647 12351 14587 16932 17080 18490 20450 24895 26642 26649
 
first 30 ruth-aaron numbers (divisors):
5 24 49 77 104 153 369 492 714 1682 2107 2299 2600 2783 5405 6556 6811 8855 9800 12726 13775 18655 21183 24024 24432 24880 25839 26642 35456 40081
</pre>
 
2,083

edits