Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interesting puzzle... 2

Status
Not open for further replies.

BobRodes

Instructor
May 28, 2003
4,215
US
Recently, my father mentioned a puzzle. He said that one of his teachers gave it to him in school as a teenager to keep him quiet, and he has yet to solve it (at age 81). The puzzle is this:

You have 15 soldiers, marching in 5 rows of 3. The soldiers march for a total of 7 days. Each day, they must march in a row with different soldiers, such that they never march in their row of three with the same soldier on two different days.

It would seem doable, given that each soldier marches with 2 others, there are 7 days in a week, and a total of 14 companions each.

I've done some fooling around modeling out a solution in VB6, and it's proving to be quite complex. I'm interested to see what other people come up with.
 
Simply do a google search for:
Kirkman's School Girl Problem

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Without looking at the answer, I'd see it like this.

Think in terms of columns. The third column moved down one each day, with the back rank going to the front. That's five.

Same with the second column. That's another five permutations with each of the five. 25 different, no duplicates because each has a different soldier in column 1.



------------------------------
An old man [tiger] who lives in the UK
 
If I'm understanding you correctly, your algorithm doesn't follow the question... the first iteration in "third column moved down one each day, with the back rank going to the front" might look like this:
Code:
A B C	    A B O
D E F	    D E C
G H I  ==>   G H F
J K L	    J K I
M N O	    M N L

But in the question, each soldier "must march in a row with different soldiers, such that they never march in their row of three with the same soldier on two different days". But "A" marches with "B" twice...
 
you could think of it from 1 person standpoint


day person a person b person c
1 Me 14 choices 13 choices
2 me 12 choices 11 choices (2 lost on day 1)
3 me 10 choices 9 choices (etc)
4 me 8 choices 7 choices
5 me 6 choices 5 choices
6 me 4 choices 3 choices
7 me 2 choices 1 choice

after 7 days there are no other choices without duplicating

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top