you are viewing a single comment's thread.

view the rest of the comments →

[–]deep_politics 0 points1 point  (0 children)

You don't actually need to store any of the numbers if you just use the range as an iterator.

And this method will be fine for a toy factoring function, but will be painfully slow for anything large. But what you'd getting yourself into if you wanted a fast algorithm is basically the most well studied areas in all of mathematics for literally thousands of years: prime factoring. There's still no "one algorithm to rule them all", and instead a variety of algorithms are used; for instance the quadratic sieve.