# Mad robot

A mad robot sets off towards the North East on a journey from the point (0,0) in a coordinate system. It travels in stages by moving forward and then rotating on the spot. It follows these pseudo-code instructions:

SUB JOURNEY

DISTANCE = 1000

WHILE (DISTANCE > 0.001)

MOVE DISTANCE

STOP

ROTATE(90, DEGREES, CLOCKWISE)

DISTANCE = DISTANCE / 2

END WHILE

EXPLODE

END SUB

Where does the robot explode?

*This problem comes from our sister site NRICH, which is packed with challenges, activities and articles for maths learners and teachers.*

*We will publish a solution next month.*

Solution link:

Mad robot: Solution
## Comments

## scratch solution

I have solved this by using scratch programming however I had to set the distance to 100 otherwise it wouldn't work. I also divided the minimum distance by 10 and my answer was(84.9,28.3) which is equivalent to (849,283) after multiplying by 10.

## The mad robot

Let's rotate the walk of the mad robot 45 degrees to the left. So it walks up or down along the y-axis and to the right or left along the x-axis. Each time the robot turns 90 degrees it steps forward half the previous step. After the 21e step it stops, because that step is smaller than 0.001. But to calculate easily we let the robot go on forever, after all it doesn't go forward anymore (the steps are too small) and only turns around its axis (it really is a mad robot). Upwarts along the y-axis the robot walks 1000(1 + 1/2^4 + 1/2^8 + ....). An infinite geometric series between the parenthesis. The result is 1000 x 16/15. Downwarts along the y-axis:

250(1 + 1/2^4 + 1/ 2^8 + ...) = 250 x 16/15. The total walk along the y-axis is also 750 x 16/15 = 800. Along the x-axis, the robot starts with 500, so the covered way along the x-axis is 400, half the covered way along the y-axis. Therefore, the robot reaches the point (400,800). But remember, initially we did rotate its walk, so we have to rotate back 45 degrees. The final destination of the mad robot is (600√2,200√2) or (849,283).

Hub Boreas

## Thanks for a solution that

Thanks for a solution that doesn't involve logs.

## a possible solution

the bot should make logbase2 1000 moves, which is 10 when the ceiling function is used. the robot starts facing north and goes 1000 steps, it then proceeds to go 500 east, 250 south, 125 west, 62.5 north, 31.25 east, 15.625 south, 7.8125 west, 3.90625 north, 1.953125 east. this means that it has gone 1000 - 250+62.5-15.625+3.90625 = 800.78125 north and 500-125+31.25-7.8125+1.953125 = 400.390625 east. this means, via pythag, that the robot has traveled 895.301 to 3dp. he has also gone overall in a direction of 26.57 degrees true.

## A more geometrical approach

I'd rather prefer a more geometrical approach... For example: let

F_1be the figure formed by the first 4 segments of the robot's journey,F_2be the figure formed by the segments 5th to 8th , and so on. It is easy to see that a certain (fixed) homothety of center, say,Ptransforms eachF_iintoF_{i+1}; furthermore,Pis the intersection of two perpendicular linesrandswhich can be found by observing carefullyF_1andF_2. At the end of each stage, the robot is either onror ons, and closer and closer toP... Completing this argument will give you an elegant solution to the problem!