SP1788 FRACTAN - Fractan
Description
To play the "fraction game" corresponding to a given list `f $ _{1} $ , f $ _{2} $ , ..., f $ _{k} $ ` of fractions and starting integer `N`, you repeatedly multiply the integer you have at any stage (initially `N`) by the earliest `f $ _{i} $ ` in the list for which the answer is integral. Whenever there is no such `f $ _{i} $ `, the game stops.
Formally, we define a sequence by `S $ _{0} $ =N`, and `S $ _{j+1} $ =f $ _{i} $ S $ _{j} $ `, if for `1
Input Format
N/A
Output Format
N/A