Talk:Weird numbers: Difference between revisions
Content added Content deleted
(A faster and less ambitious algorithm ?) |
|||
Line 4: | Line 4: | ||
Perhaps some were abandoned after first-sketch exhaustive searches appeared interminably slow ? |
Perhaps some were abandoned after first-sketch exhaustive searches appeared interminably slow ? |
||
And |
And possibly the references to number theory in the Perl 6 founding example could look a bit daunting to some ? |
||
Here is a theoretically unambitious approach, which seems, for example, to compress the (functionally composed) Python version down to c. 300 ms for 50 weirds (about half that for 25 weirds), on a system which needs c. 24 seconds to find 25 weirds with the initial Perl 6 draft. |
Here is a theoretically unambitious approach, which seems, for example, to compress the (functionally composed) Python version down to c. 300 ms for 50 weirds (about half that for 25 weirds), on a system which needs c. 24 seconds to find 25 weirds with the initial Perl 6 draft. |
||
Line 12: | Line 12: | ||
# Generate the properDivisors in '''descending''' order of magnitude. |
# Generate the properDivisors in '''descending''' order of magnitude. |
||
A smaller target should, I think, involve a smaller number of possible sums. The obvious candidate in an abundant number is the '''difference''' between the sum of the proper divisors and the number considered. If a sum to that difference exists, then removing the participants in |
A smaller target should, I think, involve a smaller number of possible sums. The obvious candidate in an abundant number is the '''difference''' between the sum of the proper divisors and the number considered. If a sum to that difference exists, then removing the participants in the smaller sum will leave a set which sums to the abundant number itself. |
||
For possible early-failing implementations of hasSum, see the Python, Haskell, JavaScript and even AppleScript drafts. |
For possible early-failing implementations of hasSum, see the Python, Haskell, JavaScript and even AppleScript drafts. |