-
Notifications
You must be signed in to change notification settings - Fork 112
Description
A factorization of a number requires that one accounts both for what prime numbers are present and also for what power each of them are raised to.
Thus, some of the factorization outputs for the given code are extremely confusing, since they yield factors lists that very clearly do not equal what they claim to factorize. E.g. 1 * 2 is definitely not equal 4294967296, contrary to what the code outputs. However, 4294967296 is a pure power of 2, so what's happening is it has the same factor of 2 repeated many times, but since you used std::set it only shows up once, thereby misrepresenting the factorization.
You should either:
(1) tell the readers that you aren't showing the powers of the factors and are only concerned with finding which primes are present
(2) use multiset instead of set so that the multiple factors become apparent (very easy fix)
(3) change the code to actually count the powers and display them (harder fix, but higher quality)
This one definitely confused me, because the output looked clearly very wrong at first glance.