Puzzler #1:
A bug begins at the origin of the x,y‐plane and moves in the spiral pattern
described below.
Move 1: moves right 1 unit
Move 2: moves up 2 units
Move 3: moves left 3 units
Move 4: moves down 4 units
Move 5: moves right 5 units
etc…
Where will the bug be (at what coordinates) after his 2008th move and after
how many
moves will the bug be at (314159, – 314158)?
Puzzler #2
Suppose instead that the bug begins at the origin, but
moves by perfect square amounts as follows.
Move 1: moves right 1 unit
Move 2: moves up 4 units
Move 3: moves left 9 units
Move 4: moves down 16 units
Move 5: moves right 25 units
etc…
Where will the bug be after his 2008th move and
after how many moves will the bug be at (59078449, 59089320)?
December 2008 Solution
Puzzler #1:
After 2008 moves, the bug will be at the coordinates
(-1004,-1004) and the bug will be at
the coordinates (314159, -314158) after 628317 moves.
Puzzler #2:
After 2008 moves, the bug will be at the coordinates
(-2016032,-2018040) and the bug
will be at the coordinates (59078449, 59089320) after 10870 moves.
The following observation applies to both puzzlers. With
exception of the first move when the bug ends
up on the x‐axis, whenever the bug moves right he will end up in the 4th
quadrant, when he moves up he will
end up in the 1st quadrant, when he moves left he will end up in the
2nd quadrant and when he moves down
he will end up in the 3rd quadrant. We leave it to the reader to
convince him or herself of this observation.
Solution for Puzzler #1:
First let us note the general pattern of changes to the
bug ’s coordinates over a sequence of four
consecutive moves beginning with a movement to the right. We shall call such a
sequence of four moves a
cycle.

Each cycle will cause the first and second coordinates to
decrease by two. Now, 2008 moves corresponds to
2008/4=502 cycles. Thus the first and second coordinates, which both start at
zero , will be decreased by
two, 502 times. This leaves the bug at the coordinates (-1004, -1004) as
502*(-2)=-1004.
To de termine when the bug reaches the coordinates (314159,
-314158), we first observe that the bug is in
the 4th quadrant and thus his last move was to the right. Prior to
his final movement to the right, the bug was
in the 3rd quadrant where his coordinates were equal. We know that in
his last move, his second coordinate
wouldn’t have changed so that the previously visited location would have been
(-314158, -314158). Since
the bug started at (0,0), his coordinates would have been decreased by two,
314158 / 2 = 157079 times.
Each decrease of two corresponds to a cycle of four moves, so the bug will have
made 157079 * 4 = 628316
moves to get to the point (-314158, -314158) and thus 628317 to reach the
next and desired point
(314159, -314158).
Solution for Puzzler #2:
Let us proceed as in the previous solution, although in
this case, the details get a bit messier, so we will
just look at the first and second coordinates separately. Again we consider a
cycle of four consecutive moves
beginning with a movement to the right. Every time we begin a cycle by moving
right, the value that we will
be squaring will be four greater than for the previous cycle. Thus we will use
the expressions:(4n-3),
(4n-2), (4n-1), and 4n as the numbers we are squaring in the nth
cycle (n being some generic counting
number). For example in the first cycle, n=1, and these expressions equate to 1,
2, 3, and 4, which are the
numbers that we square in the first cycle.
Now, for the nth cycle, the first coordinate
will be changed by the amount

Similarly the for the nth cycle, the second
coordinate will be changed by the amount

As in the solution to puzzler #1, 2008 moves will
correspond to exactly 502 cycles. Thus to find the total
changes in the first and second coordinates, we add up the expressions found
above for n=1,2,3, … , 502.
Because the bug started at the coordinates (0,0), these sums will give us his
coordinates after 2008 moves.
While the sum could be obtained by brute force, we will make use of the
following mathematical formula :

where k is a positive integer .
Now summing the expression in (*) above for n=1,2,3, … ,
502 gives

(which is the 1st coordinate after
2008 moves)
Likewise summing the expression in (**) above for n=1,2,3,
… , 502 gives
(which is the 2nd
coordinate after 2008 moves)
Finally to determine how many moves it will take for the
bug to reach the point (59078449, 59089320), we
first note the that bug is in the second quadrant and thus his last move was
upward where only his second
coordinate was changed. Let k be the number of cycles that he completed when he
made it to the 3rd
quadrant two moves earlier. We can use the expression in (**) to determine the 2nd
coordinate of the bug at
the end of this kth cycle by summing the expression for n=1,2,3, … ,k
just as we did above for the value
k=502. We then have to add on the change in the second coordinate corresponding
to the bugs final move
upward to reach the point of interest. Starting the (k+1)st cycle the
bug will move right by an amount
and then finally up by the amount
Putting all of this
together gives us

Or equivalently

Using the quadratic formula this equation can be found to
have the positive solution k=2717. So the bug
will have completed 2717 full cycles and then made two additional moves in order
to reach the point
(59078449, 59089320). Since each cycle consists of 4 moves, the bug will have
made a total of
moves to reach that
point.