Treebeard's Homepage : Stumpers

# Treebeard's Stumper Answer26 April 2002

Hanky Panky

Dunn Middle School kids played a clapping game on our campout last week. They stand in a circle and sing a catchy song that starts "Down by the banks of the hanky panky," and they clap (slap!) hands with kids around the circle until the verse ends. The last person clapped is out, and the next person in line starts again. Faster claps are legal, but I usually counted 32 beats and claps per verse. If 10 kids start in a circle to play, and person number one starts by clapping person number 2, and there are always 32 claps per verse, then who will be the last person standing? What if any number of kids play?

DMS students playing the Hanky Panky clapping game.

Kids who are out have to sit in the center, which becomes a smaller and smaller "puppy pile" of kids near the end. There is a particular way to hold hands in the circle which you can see in the photo. When it gets down to the last two kids, they don't clap, but they make a kind of handshake and rock it back and forth. I don't quite understand it, but the kids seem to understand perfectly. I'm simplifying the game for the sake of a tricky stumper. The first person claps the second person (that's one), and the 32nd person to be clapped is always out. So who is the last one standing?

The song lyrics go something like this, with the 32 slaps shown with x's:

 ```x x x x x x x x x x Down by the banks of the hanky panky x x x x x x x x x Where the bullfrogs jump from bank to banky x x x x x x Where the heeps hops soda pops x x x x x x x He missed the lily and he went kerplop ```

Actually, different kids were singing different lyrics at the same time without noticing. I picked the version that makes some sense, but many kids were singing something different. It's a classic mondegreen! Didn't Jimi Hendrix really sing, 'Scuse me, while I kiss this guy? There's a fun collection of misheard lyrics at www.kissthisguy.com How many different versions are there of this Hanky Panky song, and what is the source of them all?

If ten kids play the 32-claps-and-you're-out Hanky Panky game, then kid number two will be the last one standing. Careful counting gets the answer, though I don't know a simple formula for the general problem. This puzzle goes way back in history to Flavius Josephus who found the right place to stand in a group suicide pact counting around a circle by two's until he was the last one alive. Josephus wrote a history of the Jewish revolt against Rome just after the time of Jesus. He also left behind the math legacy of Josephus problems that school kids still play for fun.

Notes:

Careful counting is all it takes to get the answer, but be sure you do it right. I was sure the last person was number four, and I even had a computer program to prove it until Max and Jillian pointed out my mistake. Remember that the first clap always goes to the second person. It's the same as starting with the first person and counting every 33rd person out.

I have to write the numbers in a circle and tap my way around with my pencil. Kid 1 claps kid 2 for one, 2 claps 3 for two, and so on until kid 2 claps kid 3 for 32. Kid number 3 is now out. The next round begins when kid 4 claps kid 5 for one and continues until kid 9 is out, and so on until lucky kid number 2 is the last one standing.

From beginning to end, the sequence of kids out in a circle of ten looks like this:

```      3  9  10  6  1  5  7  4  8  2
```

This counting is tedious and error-prone, so I wrote a short BASIC program to do it for me in a very literal way with no shortcuts. With different numbers of kids playing the same 32-claps-and-you're-out game, the results start like this:

kids last kid order out 1 1 (1) 2 2 (1,2) 3 2 (3,1,2) 4 3 (1,4,2,3) 5 1 (3,4,2,5,1) 6 4 (3,6,1,5,2,4) 7 2 (5,1,4,6,3,7,2) 8 3 (1,6,2,5,7,4,8,3) 9 9 (6,7,3,8,2,4,1,5,9) 10 2 (3,9,10,6,1,5,7,4,8,2) 11 2 (11,3,9,10,6,1,5,7,4,8,2) 12 11 (9,8,12,6,7,3,10,2,4,1,5,11) 13 5 (7,3,2,6,13,1,10,4,9,11,8,12,5) 14 10 (5,12,8,7,11,4,6,1,9,14,2,13,3,10) 15 13 (3,8,15,11,10,14,7,9,4,12,2,5,1,6,13) 16 14 (1,4,9,16,12,11,15,8,10,5,13,3,6,2,7,14) 17 13 (16,17,3,8,15,11,10,14,7,9,4,12,2,5,1,6,13) 18 10 (15,13,14,18,5,12,8,7,11,4,6,1,9,17,2,16,3,10) 19 5 (14,10,8,9,13,19,7,3,2,6,18,1,15,4,12,16,11,17,5) 20 18 (13,7,3,1,2,6,12,20,16,15,19,11,14,8,17,5,9,4,10,18)

There's no hint of a pattern in the "Last Kid Out" numbers, but look at these graphs showing even more kids. The top graph shows data for 1 to 128 kids in a circle. The bottom graph shows 1 to 1000 kids.

The zig-zags and arches show very interesting patterns. There's an arch, then a double arch, then a triple, and more until the detail is lost and the zig-zags take over in almost-order.

In fact, this simple children's game is a completely general math problem:

• With N people in the circle,
• and the Mth person is taken out in every round,
• and each new count starts with the Fth new person in the circle,
• Then who is the Kth person out?
I put my stumper with n=10, m=32, f=2, and k=10. The answer is f(10,32,2,10) = 2. My computer program can find the general solution for any {n,m,f,k}, and there are better algorithms that can find it faster. But I don't know a simple closed-form formula that can do the job by simply plugging in the numbers without a program. Now that's a stumper!

The original story of Flavius Josephus is interesting. We have it in his own words, in The Wars Of The Jews, Book 3, Chapter 8, Section 7:

However, in this extreme distress, he was not destitute of his usual sagacity; but trusting himself to the providence of God, he put his life into hazard [in the manner following]: "And now," said he, "since it is resolved among you that you will die, come on, let us commit our mutual deaths to determination by lot. He whom the lot falls to first, let him be killed by him that hath the second lot, and thus fortune shall make its progress through us all; nor shall any of us perish by his own right hand, for it would be unfair if, when the rest are gone, somebody should repent and save himself." This proposal appeared to them to be very just; and when he had prevailed with them to determine this matter by lots, he drew one of the lots for himself also. He who had the first lot laid his neck bare to him that had the next, as supposing that the general would die among them immediately; for they thought death, if Josephus might but die with them, was sweeter than life; yet was he with another left to the last, whether we must say it happened so by chance, or whether by the providence of God. And as he was very desirous neither to be condemned by the lot, nor, if he had been left to the last, to imbrue his right hand in the blood of his countrymen, he persuaded him to trust his fidelity to him, and to live as well as himself.

It's a tough story that makes me think of other rebels hiding in caves today. By grace or math skill, Josephus was last in the draw and walked away to join the Romans and become a great historian. A later version of the story by Hegesippus (or Pseudo-Hegesippus?), an early Church historian, has it that 40 rebels made a circle and killed every third remaining person, and Josephus managed to stay last along with his friend.

School kids play a gentler game to decide who's out, but I can imagine rebels with no hope chanting "Eeny, Meeny, Miney, Mo..." or "One potato, two potato, three potato, four..." It makes me think of another children's song about hard times:

Ring a-round the rosy
Pocket full of posies
Ashes, ashes!
We all fall down!
There are different interpretations of this simple song, but all agree that it's about the Black Death or Plague that killed off a massive portion of Europe's population in the 1300s. One source explains it like this:
Ring around the rosy: rosary beads give you God's help. A pocket full of posies: used to stop the odor of rotting bodies which was at one point thought to cause the plague, it was also used widely by doctors to protect them from the infected plague patients. Ashes, ashes: the church burned the dead when burying them became to laborious. We all fall down: dead.
My take is that it doesn't matter where you stand in this circle: devout or crafty or penitent, you will fall.

Hanky Panky is an interesting math stumper, but the folklore of the song and game is also interesting. I found many more Hanky Panky versions on the Web, all different from what our kids sang:

 DMS kids Where the heeps hops soda pops He missed the lily and he went kerplop DMS kids Where the heeps hops soda pops Hey mister lily pad went kerplops Laura With an eeps ops opps ooh Hey sock-a-dilly and a ding dong too 1st Wanneroo Guides With he hi ho hop Leaps off a lilly with a kerplop The Good Book of Peter Henry With a hip, hop leap and a jump. Esop kerwillie and a ker plunk! Recess Counting Games With a eips ipes ops opps One falls in and goes and goes kerplop! beautifulFREAKdotORG With a Fe, Fi, Fo Fum Whose got the dilly kerplunk Clapping games With hip hop giggle pop With a hip hop full stop. Singing A, E, I, O, U Danman's Music Library With an eep ipe ope oop Ee-sock-a-diddy and a phbbllllt Plop! (Make 'raspberry' noise with tongue) Knee Bouncing Rhymes With a hip, hop, hippity hop Jump off the lilypad, and kerplop! More Songs for Scouts to Sing With a eep op ape eep op They jump from the lily and go kerplop. With a rub-a-dub here and a rub-a-dub there, That's the way she washes her clothes. Diddly hop, jump, boogie, boogie, boogie, boogie That's the way she washes her clothes. Norton Lindsey Brownies With an E I O Um Down by the river banks. Ker plop. Songs to be Sung by a Fire With and Eeps, Iips, Oops, Umps Jump from the lily with a Ker-Plunk

Here are some Web links for further research on hanky panky:

• There is a math algorithm for the general Josephus Problem, though it's a procedure and not a simple formula. The source is Donald Knuth, The Art of Computer Programming (vol.1, page 181, problem 31?) There are good discussions of the algorithm on the Web here, and here. I know it works, but I don't quite understand it yet.

• The Josephus Flavius game and the Josephus Game Web pages have online calculators. They don't have an F variable, so pick n=10 and m=32 to get the right answer. When I have time, I'll make my own Web calculator.

• Flavius Josephus lived an interesting life in the first century C.E., and produced an important history of Judiasm and a non-Christian history of the beginning of Christianity. His books on the Jewish War and Jewish Antiquities are available from Perseus and the Christian Classics Ethereal Library. There is a Flavius Josephus Home Page.

• Childrens' clapping songs and jump rope somgs are real folklore with a life of their own. Adults can study this culture, but we aren't part of it. In addition to the "Hanky Panky" version links above, check out Clapping Games (PDF) and Recess Counting Games.

Back to Stumper