Timeline for Find prime factors in C++
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 12, 2018 at 19:49 | history | edited | Stephen Quan | CC BY-SA 3.0 |
deleted 156 characters in body
|
Apr 12, 2018 at 11:59 | comment | added | Stephen Quan | Peter the max_p isnt constant since n is a moving/shrinking target. Computationally sqrt is more expensive than squaring. However having said that there's optimization possible to reduce the need for frequent squaring. | |
Apr 12, 2018 at 7:44 | comment | added | Peter Cordes |
It's probably worth it to sqrt once instead of squaring every time time inside the loop, at least on modern CPUs that have fast floating-point sqrt hardware and fast conversion from int to double. Or maybe not because sqrt will use the same divider hardware as trial-division, so out-of-order execution can't let the first few iterations get started while waiting for p <= max_p condition to evaluate. And if you're lucky, a smart compiler will strength-reduce p*p to psquared += p .
|
|
Apr 12, 2018 at 5:40 | history | edited | Stephen Quan | CC BY-SA 3.0 |
deleted 10 characters in body
|
S Apr 12, 2018 at 5:36 | history | suggested | Summer | CC BY-SA 3.0 |
properly citing reference
|
Apr 12, 2018 at 5:27 | review | Suggested edits | |||
S Apr 12, 2018 at 5:36 | |||||
Apr 12, 2018 at 2:33 | history | edited | Stephen Quan | CC BY-SA 3.0 |
added 444 characters in body
|
Apr 11, 2018 at 22:41 | history | edited | Stephen Quan | CC BY-SA 3.0 |
edited body; added 59 characters in body; added 6 characters in body; deleted 9 characters in body
|
Apr 11, 2018 at 21:44 | history | undeleted | Stephen Quan | ||
Apr 11, 2018 at 21:44 | history | edited | Stephen Quan | CC BY-SA 3.0 |
added 122 characters in body; added 298 characters in body
|
Apr 11, 2018 at 21:40 | history | deleted | Stephen Quan | via Vote | |
Apr 11, 2018 at 21:38 | history | edited | Stephen Quan | CC BY-SA 3.0 |
deleted 18 characters in body
|
Apr 11, 2018 at 21:29 | history | edited | Stephen Quan | CC BY-SA 3.0 |
added 44 characters in body; edited body; added 18 characters in body
|
Apr 11, 2018 at 21:24 | history | answered | Stephen Quan | CC BY-SA 3.0 |