Originally Posted by

**Gui** Hey,

I'm trying to figure out how to put (the solution to) the

Josephus Problem into either an equation of a function of some sort.

**I'm starting Algebra II/10th grade, so although I understand functions I lose track of everything when logs and floors become involved.** I'd appreciate if you could please keep answers within my level of knowledge.

I've read and re-read the wiki article. I undertsna everything up to and including the sentence "This suggests that

*f*(

*n*) is an increasing odd sequence that restarts with

*f*(

*n*) = 1 whenever the index

*n* is a power of 2". When the variables m and l become involved - I no longer understand - what do they even stand for?

Any help is welcome, please and thank you!

I'll use capital L since lowecase looks like a 1.

m is introduced in order to specify the greatest power of 2 that is less than or equal to n. Then L is simply n - 2^m.

Table of n and corresponding m

Code:

n m
1 0
2 1
3 1
4 2
5 2
6 2
7 2
8 3
9 3
...

All we really care about is L because that's what gives us the answer; m gets effectively discarded.