#
# josephus.py
#
# function josephus(n,m) that returns a list of n people, numbered from 0 to n-1, in the order in which they are executed,
# every mth person in turn, with the sole survivor as the last person in the list.
#
def josephus(n, m):
lst = range(n)
while len(lst) > 1:
# mth executed person in turn
executions = lst[::m]
# difference (alive people)
lst = filter(lambda x : x not in executions, lst)
print('Executed: %s' % executions)
print('Alive: %s' % lst)
print('-' * 33)
print('Last survival: %s' % lst)