User talk:Retroburrowers: Difference between revisions

Content added Content deleted
(→‎reply2: corrected sqrt limit to reduce redundant looping with no difference in the answers...)
m (→‎reply2: typos and grammar...)
Line 173: Line 173:
Found 78498 primes to 1000000.</pre>
Found 78498 primes to 1000000.</pre>


: This difference in the amount of operations as in the amount of work done gets even larger as the range goes up; if you want to play with it, the code is posted on [https://wandbox.org/permlink/I5PmD0YsAW0ndm6q an on-line IDE here]. The reason this is true is that the SoE has about O(n log log n) asymptotic complexity which increases quite slowly with range, where as the SoS has o(n^(n log n) complexity, which increases quite quickly with range. This can be seen from the above implementation as ''i'' ranges up the the square root of (half of) the range, where the ''j'' variable ranges from a little above ''i'' for something approaching (half of) the range, so the product is O(n^(3/2)) but the span of the culling increases with increase base number so as to reduce the term to about ''log n'', with the constant extra factor of about a quarter meaningless for showing complexity with increasing range (Big-O).
: This difference in the amount of operations as in the amount of work done gets even larger as the range goes up; if you want to play with it, the code is posted on [https://wandbox.org/permlink/I5PmD0YsAW0ndm6q an on-line IDE here]. The reason for this difference is that the SoE has about O(n log log n) asymptotic complexity which increases quite slowly with range, where as the SoS has about O(n log n) complexity, which increases more quickly with range. This can be seen from the above implementation as ''i'' ranges up to (half of) the square root of the range, where the ''j'' variable ranges from a little above ''i'' to something approaching (half of) the range, so the product is O(n^(3/2)) but the span of the culling increases with increased base number so as to reduce the term to about ''log n'', with the extra constant factor of about a quarter meaningless for showing complexity with increasing range (Big-O).


: That is the reason that the SoS should not be on the SoE Task Page: it doesn't have the same asymptotic complexity, it isn't that much simpler, and it is confusing for those that can't tell the difference.
: That is the reason that the SoS should not be on the SoE Task Page: it doesn't have the same asymptotic complexity, it isn't that much simpler, and it is confusing for those that can't tell the difference.