CTK Exchange
Front Page
Movie shortcuts
Personal info
Awards
Reciprocal links
Privacy Policy

Interactive Activities

Cut The Knot!
MSET99 Talk
Games & Puzzles
Arithmetic/Algebra
Geometry
Probability
Eye Opener
Analog Gadgets
Inventor's Paradox
Did you know?...
Proofs
Math as Language
Things Impossible
My Logo
Math Poll
Other Math sit's
Guest book
News sit's

Manifesto: what CTK is about |Store| 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

CTK Exchange

Subject: "flavius recurrsion error (I think)"     Previous Topic | Next Topic
Printer-friendly copy     Email this topic to a friend    
Conferences The CTK Exchange College math Topic #8
Reading Topic #8
Katherine
Charter Member
Oct-31-00, 00:52 AM (EST)
Click to EMail Katherine Click to send private message to Katherine Click to add this user to your buddy list  
"flavius recurrsion error (I think)"
 
   Dear Sir:

I was so happy to find this site. It's really cool, and I really needed the algorithm for m=2 in the Josephus recursion problem.

It states that you are addressing m=2 in the simple solution, and the graphics appear to support this, but the data and the algorithm support m=1. I'm a little confused.

Am I correct?

I apologize if not.

Katherine


  Alert | IP Printer-friendly page | Edit | Reply | Reply With Quote | Top
alexb
Charter Member
672 posts
Oct-31-00, 00:54 AM (EST)
Click to EMail alexb Click to send private message to alexb Click to view user profileClick to add this user to your buddy list  
1. "RE: flavius recurrsion error (I think)"
In response to message #0
 
   > graphics appear to support this, but
> the data and the algorithm support m=1.
> I'm a little confused.

No, no. It's I who is confused. In what way the data and the algorithm support m=1?


  Alert | IP Printer-friendly page | Edit | Reply | Reply With Quote | Top
Katherine
Charter Member
Oct-31-00, 08:32 AM (EST)
Click to EMail Katherine Click to send private message to Katherine Click to add this user to your buddy list  
2. "RE: flavius recurrsion error (I think)"
In response to message #1
 
   Dear Sir:

Thank you for responding.

If I play the game by hand (as my teacher explained it):

m=1:
pass ball from 1 to 2, two is out, 3 picks up and passed to 4, 4 is out.

series of winners for n= 1 to 10 is: 1 1 3 1 3 5 7 1 3 5 ...

ex: in a 2 player game, pass ball from 1 to 2. 2 is out so 1 wins.

m=2
pass ball from 1 to 2 who passes to 3, 3 is out, 4 picks up and passes to 5

series of winners for n= 1 to 10 is: 1 2 2 1 4 1 4 7 1 4

ex: in a 2 player game, pass ball from 1 to 2 to 1. 1 is out, 2 wins.

I also coded Weis's algorithm using datastructures for m=1 and m=2 and they matched these numbers. But I'm looking for a recursive algorithm for m=2.

I thought your partial recursive solution of the Josephus problem stated it was using m=2, but the data used in the example supports m=1. I implemented the algorithm and got m=1 data.

Look forward to your response again.

Thanks
katherine


  Alert | IP Printer-friendly page | Edit | Reply | Reply With Quote | Top
alexb
Charter Member
672 posts
Oct-31-00, 08:35 AM (EST)
Click to EMail alexb Click to send private message to alexb Click to view user profileClick to add this user to your buddy list  
3. "RE: flavius recurrsion error (I think)"
In response to message #2
 
   Well, it's a matter of terminology - I never talked to your teacher. In my notations you count this way

m=2:

1 2 (out) 3 4 (out) ...

m=3:

1 2 3 (out) ...

My m is 1 more than yours.

I am pretty sure no one has a recursive solution for m = 2 in your notations. You may try another solution on my page that does not produce a formula but leads to an answer.

Regards,
Alexander Bogomolny


  Alert | IP Printer-friendly page | Edit | Reply | Reply With Quote | Top
Katherine
Charter Member
Oct-31-00, 08:46 AM (EST)
Click to EMail Katherine Click to send private message to Katherine Click to add this user to your buddy list  
4. "RE: flavius recurrsion error (I think)"
In response to message #3
 
   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


  Alert | IP Printer-friendly page | Edit | Reply | Reply With Quote | Top
Katherine
Charter Member
Oct-31-00, 12:36 PM (EST)
Click to EMail Katherine Click to send private message to Katherine Click to add this user to your buddy list  
5. "RE: flavius recurrsion error (I think)"
In response to message #3
 
   Dear Sir:

Here is a recursive algorithm J(n) I came up with for my m=2 notation (your m=3):

n = number of players
J(n-1) = previous player's winner (the recursive call to this algorithm)
w = winner


if (n=0) then w = 0 else
if (n=1) then w = 1 else
if (J(n-1)==n-1) then w = 2 else
if (J(n-1)==n-2) then w = 1 else w = J(n-1)+3

Even though the recursive call shows up 3 times in the algorithm, I just call it once and use the value returned in the evaluations statements.

Thanks,
katherine


  Alert | IP Printer-friendly page | Edit | Reply | Reply With Quote | Top

Conferences | Forums | Topics | Previous Topic | Next Topic

You may be curious to visit the old CTK Exchange archive.

|Front page| |Contents|

Copyright © 1996-2018 Alexander Bogomolny

[an error occurred while processing this directive]
 Advertise

New Books
Second editions of J. Conway's classic On Numbers And Games and the inimitable Winning Ways for Your Mathematical Plays