Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

N mushrooms, growing along a circle, are ready to bepicked. Walking in one direc

ID: 3614738 • Letter: N

Question

N mushrooms, growing along a circle, are ready to bepicked. Walking in one direction around the

circle, you pick the rst mushroom, skip a givennumber skip, pick the next one,skip skip again,

pick the next, and continue doing so until all mushroomsare o
the ground.

Write a program whose inputs are Nand skip. Print the mushrooms in theorder they are

picked. You may assume that Nis at most100.

Sample run:

()$ a.out

# mushrooms and skip size: 101

1 3 5 7 9 2 6 10 8 4

()$ a.out

# mushrooms and skip size: 104

1 6 2 8 5 4 7 10 3 9

()$ a.out

# mushrooms and skip size: 1010

1 3 6 10 8 9 5 2 4 7

Explanation / Answer

# mushrooms and skip size: 104

1 6 2 8 5 4 7 10 3 9

this is a variation of the Josephus Problem--can look itup