
ZOJ Problem Set  2073
Mr. Genius appreciated your work very much, but now he has a hard nut to crack. Several days ago, someone sent him a stone chest carved with beautiful graphics. Being a excellent archaeologist, Lazy knew that the chest must have some secret. When he managed to open the chest, he is pleasantly surprised to find it a ACM (Auto Clock Machine). After some study on the machine, he finally followed how the clock worked. The Principle of the operation of the clock. The clock had N stone balls. These balls initially were placed in a queue. After 24 hours, all the stone balls returned the queue. Obviously, the order of queue is different from the one 24 hours before. However, several months later, Mr. Genius found that the balls return the initial order. He called this time interval as "Clock Period". Mr. Genius knew the period was not only one. If 10 days is a "Clock Period", so is 20 days. He wanted to find the minimum one, "T". But Mr. Genius had no time to do experiments. Then he turned to you, a gifted programming student, believing that you could help him. You task is to find out T according to a given N.
The input contains several test cases.
For each case, ouput in one line the minimum clock period T, for the corresponding
N. Sample Input 38
1870
Author: LIN, Zi Source: ZOJ Monthly, January 2004 