Chef Travel Routes
Chef likes to travel very much. He plans some travel routes and wants to know their lengths. He hired you to make these calculations. But be careful, some of the routes are incorrect. There may be some misspelling in city names or there will be no road between some two consecutive cities in the route. Also note that Chef hates to visit the same city twice during his travel. Even the last city should differ from the first. Two consecutive cities in the route should also be different.
Generalized Arithmetic Progression Free Sequence
For given two positive integers a and b let's construct the sequence x[1], x[2], ... by the following rules. For k=1 we put x[1]=1. Now let k >= 2. Then x[k] is the least positive integer such that the following two conditions hold
For given two positive integers a and b let's construct the sequence x[1], x[2], ... by the following rules. For k=1 we put x[1]=1. Now let k >= 2. Then x[k] is the least positive integer such that the following two conditions hold
| ‹ previous | 10 of 33 | next › |