In the Josephus problem, people stand in a circle and every -th person is eliminated. You can model this as a functional graph where each person points to the next person to be eliminated after steps. After each elimination, update the graph structure. The sequence of eliminations follows the graph's path structure. The last person standing is the survivor.
This gives you a way to compute the answer recursively. While not a pure functional graph (it changes over time), the same intuition about following paths applies. You can use similar techniques with slight modifications to handle the changing structure. The cycle-following idea translates directly.