Every of n guests invited to a dinner has got an invitation denoted by a number from 1 to n. The guests will be sitting around a round table with n seats. The waiter has decided to derve them according to the following rule. At first, he selects one guest and serves him/her at any place. Thereafter, he selects the guests one by one: having chosen a guest, he goes around the table for the number of seats equal to the preceeding guest's invitation number (starting from the seat of the preceeding guest), and serves the guest there.
Find all n for which he can select the guests in such an order to serve all the guests. combinatorics unsolvedcombinatorics