Finite Sequence Generator
Problem 693
Two positive integers and () can generate a sequence in the following manner:
The number of terms in this sequence is denoted .
For example, with and , we get , , , etc. Giving the sequence of 29 terms:
Hence .
Hence .
is defined to be the maximum value of for . For example, .
Further, define to be the maximum value of for . For example, and .
Find .