News for hackers. Stuff that matters.
Re:Finding divisors of a number with Python (2019) by nh23423fefe on Thursday December 08, 2022 @12:19PM (#33910444)
why would you check excess numbers instead of just checking n^2 < end

for (int i=0; i<sqrt(n); i++) == for (int i=0; i*i < n; i++)

^2 is monotonic

Re:Finding divisors of a number with Python (2019) by periram on Thursday December 08, 2022 @12:24PM (#33910513)
Also (n+1)^ = n^2 + 2n +1 i.e. you can have the previous square and just add 2n+1 to it to get the next square (which is 3 additions in total). square += i + i + 1 if square < n; break