There is an ant which can walk around on a planar grid. The ant can move one space at a time left, right, up or down. That is, from (x, y) the ant can go to (x+1, y), (x-1, y), (x, y+1), and (x, y-1). Squares where the sum of the digits of the x coordinate plus the sum of the digits of the y coordinate are greater than 25 are inaccessible to the ant. How many squares can the ant access if it starts at (0, 0), including (0, 0) itself?
ant puzzle
Page 1 of 16 Replies - 2931 Views - Last Post: 14 January 2009 - 09:30 AM
Replies To: ant puzzle
#2
Re: ant puzzle
Posted 13 January 2009 - 05:13 AM
Depends on what you mean by 'sum of the digits'. Say the ant was at 12,13. Would that add up to 25, or would it add up to 7?
Also, for the purposes of this exercise, are you assuming that negative numbers count as positive for the totals? Say the ant was at 12,-13. Would that add up to 25, or -1?
Also, for the purposes of this exercise, are you assuming that negative numbers count as positive for the totals? Say the ant was at 12,-13. Would that add up to 25, or -1?
#3
Re: ant puzzle
Posted 13 January 2009 - 07:31 AM
Hmmm...
Seems like an optimization problem...
....Run away....
Well it would seem like there are lines boarding the region, if (assuming that the absolute value is compared to 25 and not sum of negative and positives which would change things) the boarder points are (25,0) (-25,0) (0,25) and (0, -25) Now they would follow a line back towards the axis ie (1,-24) (2, -23) and so on. (Again assuming taking absolute value of the sum)
Now for how many squares....
Too early to do the math ill check back later and see if it has been answered, and if I interpreted the problem correctly, and then try the math.
Seems like an optimization problem...
....Run away....
Well it would seem like there are lines boarding the region, if (assuming that the absolute value is compared to 25 and not sum of negative and positives which would change things) the boarder points are (25,0) (-25,0) (0,25) and (0, -25) Now they would follow a line back towards the axis ie (1,-24) (2, -23) and so on. (Again assuming taking absolute value of the sum)
Now for how many squares....
Too early to do the math ill check back later and see if it has been answered, and if I interpreted the problem correctly, and then try the math.
#4
Re: ant puzzle
Posted 13 January 2009 - 07:50 AM
The answer should be 676, although I imagine the answer 625 is a common one. ?If someone says 625, they are missing out the row/column where either X=0 or Y=0.
#5
Re: ant puzzle
Posted 13 January 2009 - 11:13 AM
Is my interpretation of the problem correct?
Do you ignore the negative sign?
Do you ignore the negative sign?
#6
Re: ant puzzle
Posted 14 January 2009 - 07:27 AM
I don't know, it's your puzzle lol.
I took your interpretation though, when I worked out the answer, so I hope you are right.
I took your interpretation though, when I worked out the answer, so I hope you are right.
#7
Re: ant puzzle
Posted 14 January 2009 - 09:30 AM
Quote
The answer should be 676, although I imagine the answer 625 is a common one. ?If someone says 625, they are missing out the row/column where either X=0 or Y=0.
Actually I believe the answer is 1351, if my interpretation is correct. How:
Well if the outline of the plot is contained by the lines outlined in my previous post we can determine the equations for these lines in the form y = mx + b, where m is the slope of the line determined by deltaY/deltaX, and be is the y-intercept.
To get these equations we take the fact that the line in the first quadrant contains the Points:
(0,25),(1,24),(2,23) .... (23,2),(24,1), (25,0)
So in effect the slope would be: (25-24)/(0-1) = -1, and the y intercept is 25 giving the equation:
y = 25 - x
Similarly you can get equations for the 3 other bounding lines, which turn out to be:
y = x + 25, y = x - 25, and y = -(x + 25)
Now if we plot this on a standard Cartesian Coordinate System we see that the lines form a square:

Now to get the number of grid squares (with the grid squares being represented by points) we can calculate the area.
We can also note that the square is symetrical about the y and x axes, so we can calculate the area in the first quadrant and multiply by four to get the total area.
Now to get the area we can either use an integral or use the area of a triangle (A = (0.5)*base*height)
Doing the integral for the 1st quadrant we get: A = Integral(25 - x, 0, 25, x) (Where 0, 25 are the limits of integration and x is the integration variable).
Doing this we get:
25x - x^2/2 evaluated from x = 0 to x = 25
Subing in 25 and 0 we get 625/2.
With the area of a triangle formula we note the base is 25, as well as the height giving us: (0.5) * 25 * 25 or 625/2 as well.
Now here is were Bort made the mistake, he only took into account the ant moving up not down along the y-axis. So ineffect instead of multiplying by four he multiplied by 2, getting the answer 625.
Now instead we multiply by 4 giving us 1250.
Now this is where we have to be very careful, noting that in the calculation so far we do not take into account that the origin as well as the lines x=0 and y=0 up to 25.
So along the x axis we have a total of 51 points, including the origin, so this brings us up to total of 1301.
Next is the y-axis to take into account giving us 50, not including the origin as we don't want to count it twice bring the grand total up to:
1351
We can also check this answer by noting that along the x axis we have 51 available points, including origin, moving up down 1 effectively elimanates 2 options each time until we only have 1 point left.
So we can total this up by doing something like:
Total Points = 51 + 2*49 + 2*47 + 2*45 + ... + 2*5 + 2*3 +2*1 or more effectively:
Total Points = 51 + 2*(49 + 47 + 45 + .... + 5 + 3 + 1)
We can write the second part as the sum of the first 25 odd numbers or:
Total Points = 51 + 2*SUM(2n-1) (Where n goes from 1-25)
Solving this we have 51 + 2 * (2*SUM(n) - SUM(1)) (Where n goes from 1-25)
This gives us: 51 + 2 * (2 * 325 - 25)
=51 + 2 * 625 = 51 + 1250
=1351
We see that the answers turn out the same.
QED!
P.S.
@itzsree: Let me know of this interpretation is correct or not.
Page 1 of 1

New Topic/Question


MultiQuote



|