josephus problem, second try updated