(https://en.wikipedia.org/wiki/Josephus_problem)
def Josie(n): x=range(1,n+1) while len(x)>2: a=x[:2] print x[2], c=x[3:] x=c+a print x
Josie(41)
3 6 9 12 15 18 21 24 27 30 33 36 39 1 5 10 14 19 23 28 32 37 41 7 13 20 26 34 40 8 17 29 38 11 25 2 22 4 35 [16, 31]