Ask Uncle Colin: Factors! | Colin

Dear Uncle Colin,

If you know all of the factors of $n$, can you use that to find all of the factors of $n^2$? For example, I know that 6 has factors 1, 2, 3 and 6. Its square, 36, has the same factors, as well as 4, 9, 12, 18 and 36, but I don’t see an easy way to find them all — just squaring the original factors misses 12 and 18, and looping over all of the possibilities seems inefficient, especially for larger numbers.

– Something Quite Upsetting About Recursively Enumerating Divisors

Hi, SQUARED – and thank you for your message!

Sadly, I don’t think there’s a quick and simple…

Continue reading at:
http://ift.tt/2tgsfAr

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s