Lexington High School Mathematics Math Dept. Front Page  | Student Links  | Family Links 
Introduction to C++, Kevin Kelly Kelly Front Page  | C++ Course Guide | C++ Assignments | C++ Info

Assignment 25: List of factorizations

due Tuesday 4/30

This is a follow-up to the factoring assignment (Assignment 24). You might want to copy your previous program (cp a24.cpp a25.cpp) then modify it to fit this assignment. Make sure you update the assignment number at the top of the program.

Write a program that will factor all the integer numbers in an interval that the user specifies. Here's an example of what the user interaction should look like:

Starting number? 6
Ending number? 8
6 = 2 * 3
7 = 7
8 = 2 * 2 * 2

You might find that your factoring method takes a very long time when it is used many times over. If so, is your program doing more work than it really needs to? Consider ways to modify your approach to make it more efficient.

Test values for sample runs

Use these two intervals of numbers:
2 to 99
123456700 to 123456800


Extensions

For 5 of the 10 extension points: Make your program display any repeated factors as powers, as in this example.
360 = 2^3 * 3^2 * 5

For 5 of the 10 extension points: Choose a factoring method that works efficiently enough that the 123456700 to 123456800 test run is completed in less than a minute (on neon under typical conditions). If you believe you have achieved this kind of speed, demonstrate your program to me during class to receive these extension points.