Gator And Ducks

Gator And Ducks

Suppose there are ducks floating on the pond in a circle. The pond is also home for alligator with a fondness for ducks. Beginning at a particular position (duck number 1) the alligator counts clockwise around the circle and eats every step-th duck (the circle closing as ducks are eaten).

For example, when ducks = 8 and step = 4, the following diagram shows duck number outside and consumption order inside:

example

The first duck is fifth on the menu, the second is forth, etc. The sequence 5, 4, 6, 1, 3, 8, 7, 2 of orders of consumption completely describes alligator's menu.

Write a script which returns the orders of consumption of the ducks given...

You should be an authorized user in order to see the full description and start solving this mission.