First implementation.
Not ideal, since it can slow down quite a bit near the end.
removed commented out old version
Refactored to allow passing lower_bound, upper_bound, and total as CLI arguments.
Added comments and explanations.
Added validation of CLI arguments