Machine Problem: Piper and Leo

This is for our CS Programming course. Can you help me? :( I really need it. And I can't understand what would be the sequence of this Machine Problem. I really hope you guys can help me. Thank you in Advance <3


Machine Problem:

Piper and Leo
Introduction
A party game has the N party guests sitting in a circle on chairs numbered, in a clockwise direction, one to N. A cup of beverage is passed from person to person around the circle in the clockwise direction, starting with the person sitting on chair number one. Every person takes a drink from the cup before passing it on. Regardless of how many are sitting in the circle, after every 17th person has a drink, he is eliminated from the circle and does not drink again. The next person becomes number one and the process repeats. Thus the number of people in the circle reduces. People sit on the same chair for the entire game.
Leo and Piper are very fond of the beverage being served and want as much of it as possible. To do this they want to be the last two to be eliminated from the circle.

Problem
Write a program that will determine the chair numbers that Leo and Piper should sit on to be the last pair left.

Input
An integer representing the initial number of people in the game

Output
Display the sequence (according to initial chair numbers) of eliminations, and the best seats for Piper and Leo. See sample runs for the format.

Input Validation
None

Sample Runs
5
SEQUENCE OF ELIMINATION
2,1,4,3,5
THE BEST SEATS FOR PIPER AND LEO ARE 3 AND 5
If there are five people, wouldn't the sequence of elimination be this?:

2, 3, 5, 1, 4
Topic archived. No new replies allowed.