HOLIDAY SPECIAL, Fall Semester 2001

Here we go with another 30 POINTS offer: Write a program that returns for an arbitrary input number x_1 (of course, a natural number) the natural number N with the property that x_N=1 and x_k not 1 for all integers k strictly between 1 and N, where x is the sequence from last week's Internet Special. Test your program by producing a list for all starting values x_1 between 1 and 1000. Turn in this list together with a print out of your program. The deadline for this Thanksgiving Holiday Special is Tuesday after Thanksgiving, 3:30 pm.
Example:For the input 23, the output of your program should be 12, because if x_1=23, then x_{12}=1, and x_k not 1 for all integers k strictly between 1 and 12.