Factor-perfect numbers: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: final 48 back in)
(→‎{{header|Wren}}: Added a final 48 for consistency with other examples.)
Line 344: Line 344:


var listing = moreMultiples.call([1], Int.properDivisors(48))
var listing = moreMultiples.call([1], Int.properDivisors(48))
listing.add([1, 48])
listing.sort { |l1, l2|
listing.sort { |l1, l2|
var c1 = l1.count
var c1 = l1.count
Line 355: Line 354:
return false
return false
}
}
listing.each { |l| l.add(48) }
listing.add([1, 48])
System.print("%(listing.count) sequences using first definition:")
System.print("%(listing.count) sequences using first definition:")
Fmt.tprint("$-17n", listing, 4)
Fmt.tprint("$-17n", listing, 4)
Line 380: Line 381:
<pre>
<pre>
48 sequences using first definition:
48 sequences using first definition:
[1, 2] [1, 2, 4] [1, 2, 4, 8] [1, 2, 4, 8, 16]
[1, 2, 48] [1, 2, 4, 48] [1, 2, 4, 8, 48] [1, 2, 4, 8, 16, 48]
[1, 2, 4, 8, 24] [1, 2, 4, 12] [1, 2, 4, 12, 24] [1, 2, 4, 16]
[1, 2, 4, 8, 24, 48] [1, 2, 4, 12, 48] [1, 2, 4, 12, 24, 48] [1, 2, 4, 16, 48]
[1, 2, 4, 24] [1, 2, 6] [1, 2, 6, 12] [1, 2, 6, 12, 24]
[1, 2, 4, 24, 48] [1, 2, 6, 48] [1, 2, 6, 12, 48] [1, 2, 6, 12, 24, 48]
[1, 2, 6, 24] [1, 2, 8] [1, 2, 8, 16] [1, 2, 8, 24]
[1, 2, 6, 24, 48] [1, 2, 8, 48] [1, 2, 8, 16, 48] [1, 2, 8, 24, 48]
[1, 2, 12] [1, 2, 12, 24] [1, 2, 16] [1, 2, 24]
[1, 2, 12, 48] [1, 2, 12, 24, 48] [1, 2, 16, 48] [1, 2, 24, 48]
[1, 3] [1, 3, 6] [1, 3, 6, 12] [1, 3, 6, 12, 24]
[1, 3, 48] [1, 3, 6, 48] [1, 3, 6, 12, 48] [1, 3, 6, 12, 24, 48]
[1, 3, 6, 24] [1, 3, 12] [1, 3, 12, 24] [1, 3, 24]
[1, 3, 6, 24, 48] [1, 3, 12, 48] [1, 3, 12, 24, 48] [1, 3, 24, 48]
[1, 4] [1, 4, 8] [1, 4, 8, 16] [1, 4, 8, 24]
[1, 4, 48] [1, 4, 8, 48] [1, 4, 8, 16, 48] [1, 4, 8, 24, 48]
[1, 4, 12] [1, 4, 12, 24] [1, 4, 16] [1, 4, 24]
[1, 4, 12, 48] [1, 4, 12, 24, 48] [1, 4, 16, 48] [1, 4, 24, 48]
[1, 6] [1, 6, 12] [1, 6, 12, 24] [1, 6, 24]
[1, 6, 48] [1, 6, 12, 48] [1, 6, 12, 24, 48] [1, 6, 24, 48]
[1, 8] [1, 8, 16] [1, 8, 24] [1, 12]
[1, 8, 48] [1, 8, 16, 48] [1, 8, 24, 48] [1, 12, 48]
[1, 12, 24] [1, 16] [1, 24] [1, 48]
[1, 12, 24, 48] [1, 16, 48] [1, 24, 48] [1, 48]


48 sequences using second definition:
48 sequences using second definition: