There is a formula in wikipedia for the general case of josepus problem
But there is no reference for it, I don't know where it came from and I need too find out...
Maybe Donald Knuth's Art of Programming?
In "Concrete Mathematics" by Graham, Knuth, Patashnik. Look in Chapter 3: Integer functions.
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
2 years ago