So in your notation you don't have an m=0. Which in my book says if m=0, then players are eliminated in order and the last player always wins. That would be your m=1?We're using: Data Structures and Problem Solving using JAVA by Mark Allen Weiss. In Chapter 13 is the Josephus problem (pg 349). I heard the C++ book he wrote had the same problems. Problem 13.6 gives an algorithm for M=1 (but I like yours better, but you call it M=2). Yours and his yield the same results.
13.8 asks for the general formula for an N player game with m=2. He calls m - passes. I assumed it was recursive, but maybe not.
Anyway, thanks.
katherine