Whenever I get sick I tend to have an odd little reaction. My mind seems to slip into recursive loops and OCD like obsessions. Very odd. It’s like the programming breaks down and some acknowledgement flag that is normally set by the brain forgets to fire and I continue processing data trying to come up with an answer. As a programmer, I can totally relate. As a human, it gets annoying.
My latest obsession, while fighting off this damned cold, has been the riddles and puzzles my coworkers and I have been solving. Every day we have a new puzzle or riddle, or two, and spend some time trying to figure them out over our morning coffee. It’s a fun little exercise in logic and creative thinking… perfect for a bunch of programmers creating computer games. Some are incredibly easy, others require more thought. Lately, bored with the riddles, word play and cryptography, we’ve delved into math puzzles.
These were the latest two:
The first puzzle: using the numbers 1 through 9, place each number in the circle. The only rule is the three connected circles in a row must add up to 18. This was a bit of a twist on the Magic Square. This was fun as I not only had determined the answer, but was able to prove there is only one possible answer. The key is to create a list of all possible combinations (easier than it sounds) and eliminate invalid ones.
Since you’ll use 1 through 9, you can assume the following will be used: 1+17, 2+16, 3+15, 4+14, etc. to 9+9. That second number will need to be two other numbers, so what could those possibly be? 1+[(8+9)]… 2+[(7+9)] (can’t be 8+8 because you can only use a number once)… 3+[(6+9) or (7+8)]… etc. Starting with the 1, we know it can only be 8 and 9, or 9 and 8. Write them both in (8/9) in one and (9/8) in the other. We can then use the 6 -> 6 + [(5+7), (4+8), (3+9)] and figure out what the two other joined options could be (5 and 7 since the others use an 8 and 9, which we are already using)… and so on. You eventually get to a point where there are two possible sets of options, however, the number 2 only exists in one of those possible sets, so you can ignore the other and collapse the possibilities down to just the one. There’s your answer and proof there’s only one possible option. Fairly simple, right?
The second puzzle: The simplicity and elegance made me fall in love with this. I’ve become obsessed with not only the answer, but the geometry and math behind it. I blame being sick for the OCD compulsion on this one. Forgive my drawings (it should be a wolf and duck). There is a wolf-demon thing on the edge of a circular lake, it can only travel around the edge. There is a duck-like frog thing in the center and can swim in any direction. The wolf-demon can move 4 times faster than the duck-frog. As the duck-frog moves, the wolf-demon will move as fast as it can towards the closest place to the duck-frog to eat it. What is the shortest path the duck-frog must take to avoid the wolf-demon?
If the duck-frog just ran, it will travel the radius, r. In that time, the wolf-demon can travel 4r, 4 times faster. To travel from one end to the other, half the circumference of the circle, is PI*r or 3.14159r… much less than the 4r the wolf-demon can travel, so the wolf-demon can easily eat the duck-frog. Is it possible to avoid the wolf-demon and how so?
I started going off making the problem much harder than it is. I was thinking you could plot out the sine wave and cosine wave of the motion of the wolf and map the position of the duck based on its slope/wave form of its possible distance it could travel in a given time and find the intersection of the circle in such a way that the wolf had yet to get there… if possible. Silly me. I had to leave work and pickup my son from school, so I kept thinking about it as I was driving to get him. I nearly ran a red light, but was kicking myself that the answer was so simple. I went home and started drawing out the geometry, as I knew how it could be done, but not how you could calculate it out and determine the math and geometry of it. That’s where my OCD sick brain kicked into overdrive:
*sigh* I’m still a little foggy and can’t seem to get beyond the math required for a distance along a circumference relating to the distance traveled along a spiral with a common angular velocity. If anyone has the math, I’d love to see it.
Any way, here’s the answer…
The duck-frog runs to the edge, but rotates around based on the wolf-demon’s path. It matches it’s angle in the opposite direction, so the wolf-demon will always have 180 degrees to travel around the circle. Think of it like a spiral out. However, at the beginning, the duck-frog can move out faster than it needs to move sideways, but as it increases it’s distance, it will need to move sideways more than it can move towards the edge to maintain being on the exact opposite side of the wolf. Because it is 4 times slower, at 1/4r it will be at a point where it’s angular velocity is exactly the same as the wolf’s… it’s orbit speed matches that of the wolf’s… when it goes 90 degrees around the circle, the wolf goes 90 degrees too… it’s the radius of a geosynchronous orbit between the duck and wolf, keeping them always 180 degrees away. They could stay that way forever. Closer in towards the center, the duck can go faster around (which allows the duck to move in and out while matching the orbit of the wolf) and further away from 1/4r, the wolf can travel faster and catch up to the duck. Since the closest path from the duck at 1/4r to the edge is a straight line, it’s in the duck’s best interest to just run as fast as it can and hope the wolf can’t catch it.
Can it? At that point, the duck must travel 3/4r to get to the edge. The wolf, traveling 4 times faster, can travel 4*(3/4)r = 3r. As long as the duck maintained the angular rotation of the wolf, the wolf must travel half the circumference of the circle, which as we noted was PI*r or 3.14159r. That’s a distance 0.14159 greater than the 3r it has time to travel… so… the duck-frog escapes the lake and evades the wolf-demon! Hurray!
The best path will look like a cross-section of a spoon. A spiral that shoots out from the center quickly and then swoops into the 1/4r radius (maintaining a constant distance traveled along a constant angular rotation), in an arcing motion spiraling out. At the 1/4r radius, it simple shoots straight out towards the edge with no angular rotation.
However, I’m determined to know what the actual equation is! Stupid OCD brain won’t let it go. That’s probably why I’m writing this… to release the demons in my mind. ;) So I’m thinking if R < 1/4r, the second derivative is constant and equal to 1/4D (wolf’s distance traveled), which per angle degree theta, varies the slope of the path from pure vertical at R=0 to pure horizontal at R=1/4r. If you are given the distance r is and the actual velocity the wolf can travel, you should be able to determine at what angle R = 1/4r. So when R >= 1/4r, theta = X is the simple polar equation for the path taken.
When R >= 0 and R < 1/4r, R = some equation that has a constant distance traveled per angular change and relating to the angle and distance traveled by the wolf. When R >= 1/4r, Theta = X, where X was the previous equation, solved for theta when R = 1/4r.
Seems straight forward, right?!
My brain won’t let this go and although I have a feeling I just actually said what the basis for the equations are, I can’t seem to piece them together.
Stop being sick so I can figure this out or let this go.