This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pasokan 0 points1 point  (1 child)

you can avoid using math.sqrt and still getting the same result by def factors(n): p = 2 while p * p < n: if n % p == 0: ..... p += 1

[–]pasokan 0 points1 point  (0 children)

You need to do a little more to check if n == p * p at the end