Skip to main content

Timeline for Find prime factors in C++

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Aug 27, 2023 at 10:51 comment added Toby Speight @Summer, i * i is at risk of overflow. Consider i <= x / i instead - or, for better performance, see greater_than_sqrt() in this question.
Aug 27, 2023 at 10:48 history edited Toby Speight
edited tags
Apr 12, 2018 at 6:32 history tweeted twitter.com/StackCodeReview/status/984318422900248576
Apr 11, 2018 at 21:24 answer added Stephen Quan timeline score: 4
Apr 11, 2018 at 17:06 vote accept coder
Apr 11, 2018 at 16:38 comment added Summer In your loop checking for prime you iterate to x/2 which does not represent the square root as you intend. Technically the loop should still cover the desired range. i * i <= x would be more optimal. Or while(i * i <= x)
Apr 11, 2018 at 14:52 history edited 200_success CC BY-SA 3.0
edited tags; edited title
Apr 11, 2018 at 14:43 answer added Zeta timeline score: 25
Apr 11, 2018 at 13:37 history asked coder CC BY-SA 3.0