Proper divisors: Difference between revisions

Content added Content deleted
m (→‎{{header|Sidef}}: modified the code to work with Sidef 2.30)
Line 2,516: Line 2,516:
divs << 1 if (x > 1)
divs << 1 if (x > 1)


for d in (2 ..^ x.isqrt) {
for d in (2 .. x.isqrt) {
var y = (x // d)
var y = (x // d)
if (y*d == x) {
if (y*d == x) {
Line 2,527: Line 2,527:
}
}


10.times { |i| say "#{i}\t#{propdiv(i).dump}" }
10.times { |i| say "#{i}\t#{propdiv(i)}" }


var max = 0
var max = 0
var candidates = []
var candidates = []
20_000.times { |i|
for i in (1 ..^ 20_000) {
var divs = propdiv(i).len
var divs = propdiv(i).len
if (divs > max) {
if (divs > max) {
Line 2,540: Line 2,540:
}
}


say "max = #{max}, candidates = #{candidates.dump}"</lang>
say "max = #{max}, candidates = #{candidates}"</lang>
{{out}}
{{out}}
<pre>
<pre>