Take any whole number greater than one.
1. If the number is odd, multiply it by three and add one.
2. If it is even divide it by two.
2a. If the result is still even, continue to divide by two until the result is odd.
3. Continue steps 1 and 2 until you get the same number twice.
[For example starting with 9 -> 28 -> 14 -> 7 which is considered one iteration. The next iteration brings this to 11.]
What number(s) does this process terminate at?
What starting value less than 200 takes the most iterations to terminate?
I have continued running my program, and after hours of high energy consumption, my computer has determined that the maximum number of iterations needed for a number under 1 billion is 370.
The smallest number to take this many iterations is 670,617,279.
I am really sorry about all of my earlier posts, but I didn't stop to think about the limitations of the variables. I have changed the statements to the correct values, and again, I am very sorry.
|
Posted by Justin
on 2006-01-21 14:31:03 |