A Formula For Generalized Josephus problem There is a formula in wikipedia for the general case of josepus problem

Josephus 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.