Problem Solving and Computing (CSC-103 98S)

[Instructions] [Search] [Current] [Changes] [Syllabus] [Handouts] [Outlines] [Journal] [Problems] [Computing] [SamR Docs] [Tutorial] [API]

# Resolutions One

These are my "resolutions" (commentaries, partial answers, etc.) for the first set of problem.

1. Paper Strip

I began my visualizing a piece of paper, although I expect many would prefer to work with an actual paper. I noted that one fold gives me one crease, two folds gives me three creases, and four folds gives me seven creases.

In this case, I was able to generalize quickly by considering not only the number of creases, but also the number of pieces of paper that are then stacked on top of each other. I noted that each time we fold, we double the number of pieces of paper, and each time we fold, we add a number of creases equal to the number of pieces of paper we just had.

We start out with one piece of paper. Then we have two, then we have four, then we have eight, and so on and so forth. This means that the total number of creases is 1 + 2 + 4 + 8 + 16 + .... Surprisingly, I've memorized this formula. In "math-ese", "the sum from 0 to n of 2^n is (2^n+1)-1".

I confirmed that formula by considering the results I get.

• 1 is 2-1
• 1+2 = 3 is 4-1
• 1+2+4 = 7 is 8-1
• 1+2+4+8 = 15 is 16-1

Since I don't always trust my intuition, I attempted a proof. We'll come back to my proof later in the term.

For this particular problem (ten folds), the answer is 1+2+4+8+16+32+64+128+256+512 = 1023.

2. Patchwork

See the answer in the book.

3. The Beans Game

I was fortunate enough to guess a winning strategy to start with. I realized that the choice of numbers (1,2,3,4) suggested one simple strategy: whenever someone picks a number (N), I pick the number that when added to that number makes 5. For example, if my opponent picks 2, I pick 3. If my opponent picks 1, I pick 4. If I can make sure that number of beans remaining is a multiple of five when my opponent picks, then I always win.

If we have seventeen beans, I take two. There are fifteen remaining. My opponent takes some number, and I take enough to make it ten remaining. My opponent takes some number, and I take enought to make it five remaining. My opponent takes some number, and there must be four or less remaining, so I win.

4. Subtract-a-Square

I didn't come up with an immediate "key idea" for solving this problem, so I began a brute force approach: try all the possibilities and see where it gets you.

First, I listed the squares. 1*1 = 1. 2*2 = 4. 3*3 = 9. 4*4 = 16. 5*5 = 25. 6*6 = 36. The last one is too large to matter, so I stopped.

I started working on a game tree showing all possible paths in the game, but had trouble reproducing it electronically. I'll try to summarize textually.

My turn, 29 remaining. We start with 29 and it's my turn. I can take 1, leaving 28. I can take 4, leaving 25. I can take 9, leaving 20. I can take 16, leaving 13. I can take 25, leaving 4. Let's slowly consider the alternatives.

Opponent's turn, 28 remaining. If there are 28 left and it's the other player's turn, what can that player do? Take 1, leaving 27. Take 4, leaving 24. Take 9, leaving 19. Take 16, leaving 12. Take 25, leaving 3.

Hmmm ... this last one might be interesting, since the game is completely determined (we can each only choose to take 1). However, there's no guarantee that the other player will take 25. In fact, we know the other player won't choose this option, since I can then take 1, leaving 2, the other player will take 1, leaving 1, and I'll take the last 1 and win.

Opponent's turn, 25 remaining. If there are 25 left and it's the other player's turn, what can that player do? Take 1, leaving 24. Take 4, leaving 21. Take 9, leaving 16. Take 16, leaving 9. Take 25, leaving 0. This would be a win for that player, and the game would be over, with me losing. I don't want to take this path.

Opponent's turn, 20 remaining. If there are 20 left and it's the other player's turn, what can that player do? Take 1, leaving 19. Take 4, leaving 16. It's unlikely the other player will do this, since I'll then take 16 and win. Take 9, leaving 11. Take 16, leaving 4. It's unlikely the other player will do this, since I'll then take 4 and win.

Opponent's turn, 13 remaining. If there are 13 left and it's the other player's turn, what can that player do? Take 1, leaving 12. Take 4, leaving 9. That's not likely, since I'll win. Take 9, leaving 4. That's not likely, since I'll win. This is a promising chain. It's likely that I'll follow this chain of events next. But, first let's finish the other alternatives.

Opponent's turn, 4 remaining. If there are 4 left and it's the other player's turn, what can that player do? Take 1, leaving 3. Take 4, winning. This is what the player will do, so I won't choose 25.

My turn again ... We now have a large number of alternatives as there may be 27, 24, 19, 12, or 11 remaining. Of these, 12 is the most interesting, since it's guaranteed that the other player will make the pile size 12 if I make it size 13.

My turn, 12 remaining. If there are 12 beans left, I have a few options. I can take 1, leaving 11. I can take 4, leaving 8. I can take 9, leaving 3. This last option is a bad one, since the other player is guaranteed to win. Let's consider each.

Opponent's turn, 8 remaining. If there are 8 beans left, and it's the other player's turn, that player has only two choices. Take 4, leaving 4. That's a bad choice, since I'll win. Take 1, leaving 7.

My turn, 7 remaining. If there are only 7 beans left and it's my turn, I can take 1 or 4. I won't take 4, since that will leave 3, and I'll lose. So I'll take 1, leaving 6. If the other player takes 4, there will be two left, and I'll also lose. So, we don't want to reach this place.

Oppponent's turn, 11 remaining. If there are 11 beans left, and it's the other player's turn, that player has three choices: taking 9, 4, or 1. If the player takes 9, there are 2 left, and that player wins. I guess I shouldn't have left 11 beans.

My turn, 11 remaining. However, if I can force the other player to leave me with 11 beans, then I'll win.

Reflect. Looking backwards, I see that if there are twelve beans left, I lose. I can take 4, leaving 8, which leads to a loss. I can take 1, leaving 11, which also leads to a loss. Looking further backwards, I can see that the other player can leave me with 12 if I leave that player with 13. That happens if I take 16. I also note that if I leave the other player with 28, that player can take 16 and leave me with , which we've established is bad. Can I ever win?

I can't take 1, since that leaves 28 and the other player wins. I can't take 4, since that leaves 25 and the other player wins. I can't take 25, since that leaves 4 and the other player wins. I can't take 16, since that leaves 13 and the other player wins. So, I have to take 9, leaving the other player with 20.

If there are 20 left and it's the other player's turn, that player can take 1, 4, 9, or 16. If the player takes 9, there are 11 remaining. We know the player won't do that, because we've already seen what happens with 11 remaining (it's an automatic win for the player with 11). If the player takes 16, there will be 4 remaining. Also not a good plan. If the player takes 4, there will be 16 remaining. Still not a good plan. So, the other player must take 1, leaving 19. (Whoops, I did most of this analysis already. Oh well.)

My turn, 19 remaining. I can take 1, 4, 9, or 16. If I take 16, there are 3 left and I lose. If I take 9, there are 10 left. If I take 4, there are 15 left. If I take 1, there are 18 left.

Opponent's turn, 10 remaining. If it's the other player's turn and there are 10 remaining, that player can take 1, 4, or 9. Taking 1 leaves 9, which means I can win in one step. Taking 9 leaves 1, which means that I can win in one step. Taking 4 leaves 6. I can take 4, leaving 2 and a guaranteed win.

Solved! Summarize. We've now found a solution.

• I take 9. That leaves 20.
• The other player must take 1 or 9, leaving 19 or 11.
• If there are 19 left, I take 9, leaving 10. We've just seen that this lets me win.
• If there are 11 left, I take 4, leaving 7.
• If there are 7 left, the other player takes 1 or 4, leaving 6 or 3.
• If there are 3 left, I win, since we just alternate turns.
• If there are 6 left, I take 4 and there are two left. I win, since we just alternate turns.

Consider alternatives. Were there other ways to solve this problems? I suppose I could have started at the bottom and worked my way up. I.e., if there is only one bean in the pile, the player whose turn it is takes the bean and wins. If there are only two beans in the pile, the player whose turn it is takes the bean, leaving 1, and therefore loses. If there are three beans, the player whose turn it is takes the bean, leaving 2. 2 is a loss for the other player, and a win for the current player. And so on and so forth.

5. Language Students

I found it easiest to think about this in terms of "chits" that indicate that a student is taking a particular class. I know that each student may have at most one chit for each class (but may have zero for either or both classes). I can also say that no student has more than two chits.

If 81 students take Spanish and 93 take French, then there must be 174 chits. If 20 percent of 200 students take no language, then 40 students take no language and 160 students take at least one language.

If I give every student 1 chit, then there will be 14 chits remaining. Since no student can have more than 2 chits, I'll distribute those 14 chits to 14 students who already have 1 chit, and those 14 students take two languages.

6. Sandwiches

Repeated reading of this problem led me to decide to classify the sandwiches in four categories:

• H - ham only
• C - cheese only
• B - ham and cheese (both)
• N - neither

I then attempted to express all of the notes as formulae.

• "Two thirds of the ham sandwiches also have cheese" gets reformulated as "2/3 * (H + B) = B".
• "Three quarters of the cheese sandwiches also have ham" gets reformulated as "3/4 * (C + B) = C".
• "120 sandwiches have neither ham nor cheese" gets reformulated as H + C + B = 880.

I then decided to manipulate the formulas.

• Initial formula: 2/3 * (H + B) = B
• Distribute multiplication: 2/3 * H + 2/3 * B = B
• Subtract 2/3 * B from each side: 2/3 * H + 2/3 * B - 2/3 * B = B - 2/3 * B
• Simplify: 2/3 * H = 1/3 * B
• Multiply both sides by 3/2: 3/2 * 2/3 * H = 3/2 * 1/3 * B
• Simplify: H = 1/2 * B

[I decided that I could skip the steps on the other one, and ended up getting it wrong. I didn't realize this until much later in the problem, when my answer made no sense. I'm going to skip that detour here.]

Similarly, C = 1/3 * B

Now, we can use those to work on the third formula.

• H + C + B = 880.
• Substitute for H: 1/2 * B + C + B = 880
• Substitute for C: 1/2 * B + 1/3 * B + B = 880
• Make everything N/6 * B: 3/6 * B + 2/6 * B + 6/6 * B = 880
• Simplify: (3 + 2 + 6)/6 * B = 880
• Simplify some more: 11/6 * B = 880
• Multiply both sides by 6/11
• B = 880/11 * 6 = 88 * 6 = 528

Now, I stupidly stopped at this point and figured "that's close enough". However, that's not what the question asked for, and when I attempted to work out the details with someone else, I didn't seem to have the right answer.

• H = 1/2 * B so H = 264.
• C = 1/3 * B so C = 176

Let's test my answer. B + C + H = 528 + 264 + 176 = 968. Whoops! Do you see what I did wrong?

I misdivided 880 by 11. 880/11 is 80, not 88. Let's try again.

• B = 80 * 6 = 480
• H = 1/2 * B = 240
• C = 1/3 * B = 160

Let's test again. B + H + C = 480 + 240 + 160 = 880. Yay.

So, there are (B+H) = (480+240) = 720 sandwiches with ham and (C+H) = (480+160) = 640 sandwiches with cheese.

7. Four Fours

Still working on this one. There will be a separate handout.

[Instructions] [Search] [Current] [Changes] [Syllabus] [Handouts] [Outlines] [Journal] [Problems] [Computing] [SamR Docs] [Tutorial] [API]

Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.