func josephus(n, k) { var prisoners = @^n while (prisoners.len > 1) { prisoners.rotate!(k - 1).shift } return prisoners[0] }