play and relax: games for kids games
  Cut the knot: learn to enjoy mathematics
A math books store at a unique math study site. Learn to enjoy mathematics.
Google
Web CTK
Best sites for teachers
Sites for teachers
Sites for parents
Terms of use
Awards

Interactive Activities
CTK Exchange
CTK Insights - a blog

Games & Puzzles
What Is What
Arithmetic/Algebra
Geometry
Probability
Outline Mathematics
Make an Identity
Book Reviews
Eye Opener
Analog Gadgets
Inventor's Paradox
Did you know?...
Proofs
Math as Language
Things Impossible
Visual Illusions
My Logo
Math Poll
Cut The Knot!
MSET99 Talk
Other Math sites
Front Page
Movie shortcuts
Personal info
Privacy Policy

Guest book
News sites

Recommend this site

Best sites for teachers
Sites for teachers
Sites for parents

Education & Parenting

Manifesto: what CTK is about Search CTK Buying a book is a commitment to learning Table of content Things you can find on CTK Chronology of updates Email to Cut The Knot Recommend this page

Josephus Flavius Problem
Recursive Solution

A recent letter from a math teacher reminded my that the recursive solution I have been planning to describe for a while now is long overdue.

This solution applies to the case where every other person is executed (m = 2) until only one is left (r = 1, see the complete solution.)

After the first go-round we essentially come up with the same problem but for a different number of individuals. We have to distinguish between two cases: n is even and n is odd. When n is even, n = 2k, k fellows remain and on the second round we start with the one who was initially number 1. When n is odd, n = 2k + 1, just before ending the first round, we get to pick out number 1; so that number 3 becomes the next victim. On the first round we eliminate k + 1 people. In both cases, k people remain for the second round. The second round is very much like the first one, except that each person's number has been doubled and, in the first case, decreased by one, while, in the second, it was increased by one. Let J(n) denote the survivor's number. Obviously, J(1) = 1. For other n, we can write

J(2k) = 2J(k) - 1, and
J(2k + 1) = 2J(k) + 1.

There is a way to solve these recursive formulas but the result is simple enough for us just to guess the right expression. The formulas are very easy to apply. Let's build a table for the first few values of n:

n1 23 4567 89101112131415 16
J(n)1 13 1357 13579111315 1

We may now notice that J(n) is always odd and starts anew from 1 with every power of 2. It increases through all successive odd numbers until it is about to reach the next power of 2 when it again drops to 1. For every number n, there exists an integer a such that 2an<2a+1. For some 0t<2a then n = 2a + t. From the table above we may surmise the formula

J(2a + t) = 2t + 1.

We prove the formula by induction on a. For a = 1 the only admissible value of t is 0 and we only have to verify that J(1) = 1 which we know to be true. For the induction step, we assume that the formula holds for all a up to a certain value. Now consider this value of a. The induction step has two parts, depending on whether n (and thus t) is even or odd. If 2a + t = 2k, then

J(2a + t) = 2J(2a -1 + t/2) - 1 = 2(2t/2 + 1) - 1 = 2t + 1

by the inductive assumption. Similarly, if 2a + t = 2k + 1, then

J(2a + t) = 2J(2a -1 + (t-1)/2) + 1 = 2(2(t-1)/2 + 1) + 1 = 2t + 1

This completes the induction step.

Reference

  1. R. Graham, D. Knuth, O. Patashnik, Concrete Mathematics, 2nd edition, Addison-Wesley, 1994.

Copyright © 1996-2008 Alexander Bogomolny

29436865Page copy protected against web site content infringement by Copyscape


Search:
Keywords:


Latest on CTK Exchange
try this puzzle ?/?? + ?/?? + ?/? ...
Posted by albert1950
0 messages
07:05 AM, Jul-10-08

Monty Hall Problem
Posted by linkdon
72 messages
06:07 PM, Jul-24-08

Missing information
Posted by roboknight
2 messages
07:32 AM, Jun-22-08

Can You See The Patterns..?
Posted by wustvn
0 messages
10:08 AM, Jul-23-08

Mistake on the page (an aside, Be ...
Posted by Max
4 messages
10:28 AM, Feb-28-08

Central Limit Theorem proof problem
Posted by Manuel
1 messages
01:54 PM, Jul-22-08

You can drill a square hole
Posted by Giorgis
1 messages
10:15 PM, Jul-12-08