Основная идея - найти следующего человека с формулой
next position = (current position + count) modulo number of people
И в каждой итерации меньше людей.
Вот оно в питоне. "count" равен 2, потому что мы начинаем считать с нуля, что делает чуть ли не любую задачу, связанную с модулем, немного проще
people=[1,2,3,4,5]
people=['a','b','c','d','e']
count=2 # base 0 counting
pos=0
while len(people) > 1:
pos = (pos + count) % len(people)
print "at pos",pos,"eliminating person",people[pos],'from',people,
del people[pos]
print 'leaving',people
print 'winner is',people[0]
1009 * дает *
at pos 2 eliminating person c from ['a','b','c','d','e'] leaving ['a','b','d','e']
at pos 0 eliminating person a from ['a','b','d','e'] leaving ['b','d','e']
at pos 2 eliminating person e from ['b','d','e'] leaving ['b','d']
at pos 0 eliminating person b from ['b','d'] leaving ['d']
winner is d