Jesse's path

A 18 mile by 57 mile plot of land is divided into 1026 1026 counties of 1 mile by 1 mile squares. A man starts at the top right corner of the plot and travels a straight line path to the bottom left corner. In each county that he travels through, he spends 4 -4 times the sum of the amounts he spent in the previous two counties. He spends $1 in the first county and $2 in the second county. If he spends a × 2 b a\times 2^b dollars in the last county, where a a is odd and b 0 b \geq 0 , find a + b a+b .

This problem is posed by Jesse Z .

Details and assumptions

Spending a negative amount of money is equivalent to receiving money. As an explicit example, he receives $12 in the third county.


The answer is 212.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

We first attempt to find an explicit formula that corresponds to how much the man (let's call him Bob) spends in the n n th county.

Let a n a_n denote the amount that Bob spent in the n n th county he walked through, letting the first county correspond to n = 0 n=0 . We easily calculate and list the first few terms in the sequence: a 0 = 1 = 1 2 0 , a 1 = 2 = 1 2 1 , a 2 = 12 = ( 1 ) 2 1 3 2 2 , a_0 = 1 = 1\cdot2^0, a_1 = 2 = 1\cdot2^1, a_2 = -12 = (-1)^{2-1} \cdot 3 \cdot 2^2, a 3 = 40 = ( 1 ) 3 1 5 2 3 , . . . a_3 = 40 = (-1)^{3-1} \cdot 5 \cdot 2^3, ... .

It seems as though a n = ( 1 ) n 1 ( 2 n 1 ) 2 n a_n = (-1)^{n-1} \cdot (2n-1) \cdot 2^n for n 1 n \geq 1 . Let's see if this is the case: a n + 2 = 4 ( a n + 1 + a n ) = a_{n+2} = -4(a_{n+1}+a_n) = 4 ( ( 1 ) n ( 2 n + 1 ) 2 n + 1 + ( 1 ) n 1 ( 2 n 1 ) 2 n ) = -4((-1)^n \cdot (2n+1) \cdot 2^{n+1} + (-1)^{n-1} \cdot (2n-1) \cdot 2^n) = 4 ( ( 1 ) n 2 n ( ( 4 n + 2 ) ( 2 n 1 ) ) ) = -4((-1)^n \cdot 2^n \cdot ((4n+2) - (2n-1))) = ( 1 ) ( n + 2 ) 1 ( 2 ( n + 2 ) 1 ) 2 n + 2 (-1)^{(n+2) - 1} \cdot (2(n+2) - 1) \cdot 2^{n+2} \checkmark . This relation means that we've found an explicit formula for how much Bob spends in each county.

\\

Now we need to find how many counties Bob walks through on his way through the plot of land. It is well-known that the diagonal line through a rectangle with side lengths c , d Z + c,d \in \mathbb{Z}^+ will cross through c + d gcd ( c , d ) c + d - \gcd(c,d) unit squares, which means that Bob will walk through 18 + 57 gcd ( 18 , 57 ) = 72 18 + 57 - \gcd(18,57) = 72 squares (or counties, in this problem).

This can be easily verified. In order to travel 57 57 miles south and 18 18 miles west in a straight line, Bob will walk across 56 56 horizontal lines and 17 17 vertical lines which mark the borders of the counties. Each time Bob walks across a border, he enters a new county, and so the total number of counties he walks through "should" be 56 + 17 56 + 17 . However, this does not account for the fact that Bob sometimes walks across two borders at once (he walks across the corner of a county directly to a diagonally adjacent county). This clearly happens two times, since we do not care about the bottom-left corner. Finally, we need to account for the county which Bob begins in (the top-right one). Therefore, our total becomes 56 + 17 2 + 1 = 56 + 17 - 2 + 1 = 57 + 18 gcd ( 18 , 57 ) = 72 57 + 18 - \gcd(18,57) = 72 , as expected.

\\

We now know that we want to find was a 71 a_{71} is (remember that we called the first county "county 0"). Using the explicit formula we found above, we get that a 71 = ( 1 ) 71 1 ( 2 71 1 ) 2 71 = 141 2 71 a_{71} = (-1)^{71-1} \cdot (2 \cdot 71 - 1) \cdot 2^{71} = 141 \cdot 2^{71} . Thus, we have a = 141 , b = 71 a = 141, b = 71 , and so our answer is 141 + 72 = 212 141 + 72 = \fbox{212} .

\\ \\

Note: For more information on the theorem about diagonals and square grids seen above, visit this website .

Out of pure curiosity, what if a problem gave you have a m × n × k m \times n \times k rectangular prism made up of m n k 1 × 1 mnk \, 1 \times 1 cubes glued together and then asked you how many of such cubes are touched by the inner diagonal. How would you go about solving that?

Zhang Ning - 7 years, 10 months ago

Log in to reply

I believe the answer is, by PIE, m + n + k gcd ( m , n ) gcd ( m , k ) gcd ( n , k ) + gcd ( m , n , k ) m+n+k-\gcd(m,n)-\gcd(m,k)-\gcd(n,k)+\gcd(m,n,k)

Daniel Chiu - 7 years, 10 months ago

Log in to reply

Yes indeed. In fact if I am correct, this problem can be generalized into n n dimensional space using the Principle of Inclusion and Exclusion, the answer being J { a 1 , a 2 , a 3 , . . . , a n } ; J ϕ ( 1 ) J + 1 gcd ( i f o r i ϵ J ) \sum \limits_{J \in \{a_1, a_2, a_3, ..., a_n \} ; J \neq \phi }(-1)^{|J|+1} \gcd (i \ for \ i \ \epsilon J ) ), where the man starts from the origin and goes to the point ( a 1 , a 2 , . . . , a n ) (a_1, a_2, ..., a_n) .

Sreejato Bhattacharya - 7 years, 10 months ago
Tim Vermeulen
Aug 12, 2013

Let's assume the man travels from the lattice point ( 18 , 57 ) (18,57) to the origin in two-dimensional Euclidean space, where each unit square represents a county. After the man has visited the upper right county, he will still have to visit 17 17 counties to his left and 56 56 counties below him. Also, the man visits two lattice points on his way, by which he travels a square left and a square down while only visiting one new county, instead of two. So, the man visits a total of 1 + 17 + 56 2 = 72 1 + 17 + 56 - 2 = 72 counties.

Now, let M n M_n denote the amount of money the man spends in the n n -th county. We know that

M n = 4 ( M n 1 + M n 2 ) , M_n = -4(M_{n-1} + M_{n-2}),

for all integers n 3 n \geq 3 . Let's prove by induction that

M n = ( 1 ) n ( 2 n 3 ) 2 n 1 , M_n = (-1)^n \cdot (2n-3) \cdot 2^{n-1},

for all positive integers n n . The base cases M 1 = 1 M_1 = 1 and M 2 = 2 M_2 = 2 are true. Let's assume that it is true for some positive integers k 1 , k 2 k-1,k-2 with k 3 k \geq 3 . Then

M k = 4 ( M k 1 + M k 2 ) = 4 ( ( ( 1 ) k 1 ( 2 k 5 ) 2 k 2 ) + ( ( 1 ) k 2 ( 2 k 7 ) 2 k 3 ) ) = 4 ( 1 ) k 2 2 k 3 ( ( 1 ( 2 k 5 ) 2 ) + ( 2 k 7 ) ) = ( 1 ) 2 2 ( 1 ) k 2 2 k 3 ( 1 ) ( 2 k 3 ) = ( 1 ) k ( 2 k 3 ) 2 k 1 , \begin{aligned} M_k &= -4 (M_{k-1} + M_{k-2}) \\ &= -4\left( \left( (-1)^{k-1} \cdot (2k-5) \cdot 2^{k-2} \right) + \left( (-1)^{k-2} \cdot (2k-7) \cdot 2^{k-3} \right) \right) \\ &= -4 \cdot (-1)^{k-2} \cdot 2^{k-3} \cdot \left( ( -1 \cdot (2k-5) \cdot 2 ) + ( 2k-7 ) \right) \\ &= (-1) 2^2 \cdot (-1)^{k-2} \cdot 2^{k-3} \cdot (-1)(2k-3) \\ &= (-1)^k \cdot (2k-3) \cdot 2^{k-1}, \end{aligned}

which is what we wanted. So, the amount of money the man spends in the last county is

M 72 = ( 1 ) 72 ( 2 ( 72 ) 3 ) 2 72 1 = 141 2 71 , M_{72} = (-1)^{72} \cdot (2(72)-3) \cdot 2^{72-1} = 141 \cdot 2^{71},

so

a + b = 141 + 71 = 212 . a + b = 141 + 71 = \boxed{212} .

Nhat Le
Aug 13, 2013

We will divide this problem into two sections. In the first section, we have to find the number of counties the man passes through, and in the second section, we will find a general pattern for the amount of money in the n t h n^{th} county.

For the first section, we note that the greatest common divisor of 18 18 and 57 57 is 3 3 . Thus the rectangle can be further divided into 9 9 smaller rectangles, each of size 6 × 19 6 \times 19 (by dividing each side into three). The man's path will cut through the corners of exactly 3 3 of the 6 × 19 6 \times 19 rectangles.

Now, we will prove that for an m × n m \times n rectangle with g c d ( m , n ) = 1 gcd(m,n)=1 , the number of counties the man passes through when he traverses the diagonal will be m + n 1 m+n-1 . Indeed, the borders of the counties comprise m + 1 m+1 vertical lines and n + 1 n+1 horizontal lines. As the man traverses the diagonal, the number of vertical lines he crosses is m 1 m-1 and the number of horizontal lines he crosses is n 1 n-1 , because he does not cross the 2 lines at the extremes. Starting from the top corner (the first county), each time he crosses a line, he enters a new county. Because he crosses m + n 2 m+n-2 lines, the total number of counties he visits will be 1 + ( m + n 2 ) = m + n 1 1+(m+n-2)=m+n-1 .

Thus for a 6 × 19 6 \times 19 rectangle, the man will cross 6 + 19 1 = 24 6+19-1=24 counties. He crosses exactly 3 3 such rectangles, so the total number of counties he visits is 24 × 3 = 72 24 \times 3 = 72 .

We proceed to the second section, to find the general pattern for the amount spent in the n t h n^{th} county. Let A n A_n be the amount spent in the n t h n^{th} county. We calculated the first few amounts and get: A 1 = 1 , A 2 = 2 , A 3 = 12 , A 4 = 40 , A 5 = 112 , A 6 = 288 A_1 = 1, A_2 = 2, A_3=-12,A_4=40,A_5=-112, A_6=288

The question hints that the pattern will contain a 2 b 2^b term, so we quickly note that A 2 A_2 is divisible by 2 2 , A 3 A_3 is divisible by 4 4 , A 4 A_4 is divisible by 8 8 , A 5 A_5 is divisible by 16 16 , and A 6 A_6 is divisible by 32 32 . Furthermore,

A 2 2 = 1 , A 3 4 = 3 , A 4 8 = 5 , A 5 16 = 7 , A 6 32 = 9 \frac{A_2}{2} = 1, \frac{A_3}{4}=-3,\frac{A_4}{8}=5,\frac{A_5}{16}=-7, \frac{A_6}{32}=9

Thus we arrive at a conjecture: A n 2 n 1 = 2 n 3 \frac{|A_n|}{2^{n-1}}=2n-3 or A n = ( 2 n 1 ) ( 2 n 3 ) |A_n|=\left(2^{n-1}\right)(2n-3)

You can prove this using mathematical induction.

Now the answer is simple. At the 7 2 t h 72^{th} county, the absolute value of the amount spent is ( 2 72 1 ) ( 2 × 72 3 ) = 2 71 × 141 \left(2^{72-1}\right)(2\times72-3) = 2^{71}\times141 .

Therefore a + b = 71 + 141 = 212 a+b=71+141=\fbox{212}

Label the grid in Cartesian coordinates. Note that (by symmetry) the problem is not changed if the man goes from the bottom left corner to the top right corner instead (I chose this interpretation so that the co-ordinates of the intersections of the counties were positive; this was not necessary at all). Let the starting point of the man be labelled ( 0 , 0 ) (0, 0) . Then, the coordinates of the ending point are ( 18 , 57 ) (18, 57) [assuming that the horizontal length of the grid is 18 18 ; by symmetry the scenario does not change if the grid is flipped by 9 0 90^\circ ]. The equation of the path of the man is then y = 57 18 x = 19 6 x y= \frac{57}{18}x= \frac{19}{6} x , 1 x 18 1 \leq x \leq 18 (consequently 1 y 57 1 \leq y \leq 57 ). Then, note that the lattice points on the path will be ( 6 , 19 ) (6, 19) , ( 12 , 38 ) (12, 38) , and ( 18 , 57 ) (18, 57) (a lattice point is a point whose coordinates are integers; note that gcd ( 19 , 6 ) = 1 \gcd(19, 6)= 1 , so for a point to be a lattice point, its x x coordinate has to be a multiple of 6 6 ). Now, for the man to go from the bottom left corner to the top right corner, he has to cross every straight line parallel to either the x x axis or the y y axis. Call a straight line good if it is parallel to either the x x axis or the y y axis, its distance from both the axes is positive, and it connects the lattice points. Then, the man will go from one county to another if and only if he crosses a good line. Conversely, if a man crosses a good line, he shifts from the county he is in to another county. So, for the man to travel from the bottom left to the top right, he has to cross all good lines located within the grid. The total number of good lines located within the grid are 57 + 18 = 75 57+18= 75 . So we can conclude that the man has gone through 75 75 counties in total. However, we have double counted certain cases. When a man passes through a lattice point, he passes through two good lines at once (the converse is also true). As mentioned previously, there are a total of 3 3 lattice points on the man's path, so 3 3 counties have been double counted. Subtracting this number, we find out that the man has gone through 75 3 = 72 75-3= 72 counties in all.

Now let a n a_n be the sequence defined by a n + 2 = 4 ( a n + 1 + a n ) a_{n+2}= -4(a_{n+1} + a_n) for all n 3 n \geq 3 , a 1 = 1 a_1= 1 , and a 2 = 2 a_2= 2 . We simply wish to determine a 72 a_{72} . Note that the characteristic equation of the recurrence relation is x 2 4 x 4 = 0 x^2 - 4x - 4= 0 , which has only 1 1 distinct root:- x = 2 x= -2 . Hence we can conclude that the closed form for this relation will be a n = c 1 ( 2 ) n + c 2 n ( 2 ) n a_n= c_1 (-2)^n + c_2 n (-2)^n , where c 1 c_1 and c 2 c_2 are constants (see link provided). Plugging a 1 = 1 a_1= 1 and a 2 = 2 a_2= 2 , we get a system of linear equations which has solution ( c 1 , c 2 ) = ( 3 2 , 1 ) (c_1, c_2)= (-\frac{3}{2}, 1) . Therefore we get the closed form a n = 3 2 ( 2 ) n + n ( 2 ) n a_n= -\frac{3}{2} (-2)^n + n (-2)^n .

Then, a 72 = 3 2 ( 2 ) 72 + 72 ( 2 ) 72 = 141. 2 71 a_{72}= -\frac{3}{2} (-2)^{72} + 72(-2)^{72}= 141.2^{71} . Thus, a = 141 a= 141 , b = 71 b= 71 , and a + b = 141 + 71 = 212 a+b= 141+71= 212 (note that the representation of a number in the form ( 2 m + 1 ) 2 n (2m+1) 2^n is unique).

Correction :- The characteristic equation of the recurrence relation is x 2 + 4 x + 4 = 0 x^2 + 4x + 4= 0 .

Sreejato Bhattacharya - 7 years, 10 months ago
Daniel Chiu
Aug 11, 2013

First, we count the number of counties the man goes through. Let us consider a general case of a x x by y y plot. To get from the top-right to the bottom-left, he has to go down y 1 y-1 squares and over x 1 x-1 squares. Including the first square, that is x + y 1 x+y-1 squares. However, he may go down a square and over a square at the same time. This will happen gcd ( x , y ) 1 \gcd(x,y)-1 times, and each time it happens, he goes through one less county than he would usually go through. We had x + y 1 x+y-1 , and subtracting gcd ( x , y ) 1 \gcd(x,y)-1 , we have the total number of squares he goes through, x + y gcd ( x , y ) x+y-\gcd(x,y) . Applying this to our 18 by 57 plot, we find he goes through 18 + 57 3 = 72 18+57-3=72 squares.

Now, we find the amount he pays in the n n th county, a n a_n . In the third, he spends 12 -12 dollars. By induction, we will show that a n = ( 1 ) n 2 n 1 ( 2 n 3 ) a_n=(-1)^n\cdot 2^{n-1}\cdot (2n-3) for all positive integers n > 1 n>1 . For n = 2 , 3 n=2,3 , the equation is clearly satisfied. For n = k n=k , we have 4 ( ( 1 ) k 2 2 k 3 ( 2 k 7 ) + ( 1 ) k 1 2 k 2 ( 2 k 5 ) ) -4\cdot((-1)^{k-2}\cdot 2^{k-3}\cdot(2k-7)+(-1)^{k-1}\cdot 2^{k-2}\cdot (2k-5)) = 4 ( 1 ) k 1 2 k 3 ( 2 ( 2 k 5 ) ( 2 k 7 ) ) =-4\cdot(-1)^{k-1}\cdot 2^{k-3}\cdot(2(2k-5)-(2k-7)) = ( 1 ) k 2 k 1 ( 2 k 3 ) =(-1)^k\cdot 2^{k-1}\cdot(2k-3) Our induction is complete.

Finally, the amount spent in the last square is 2 71 ( 141 ) 2^{71}(141) , and the answer is 71 + 141 = 212 71+141=\boxed{212} .

Surprisingly,

a n = ( 1 ) n 2 n 1 ( 2 n 3 ) a_n = (-1)^n \cdot 2^{n-1} \cdot (2n-3)

also holds for n = 1 n=1 .

Tim Vermeulen - 7 years, 10 months ago

Log in to reply

That's not surprising as a n + 2 + 4 a n + 1 + 4 a n = 0 a_{n+2}+4a_{n+1}+4a_n = 0 is a linear recurrence relation. This has a characteristic polynomial of λ 2 + 4 λ + 4 \lambda^2+4\lambda+4 , which has a double root of λ = 2 \lambda = -2 . So, the general form will be a n = ( A n + B ) ( 2 ) n a_n = (An+B) \cdot (-2)^n for some constants A , B A,B which depend on initial conditions.

Jimmy Kariznov - 7 years, 10 months ago

Log in to reply

I know it makes sense, but when solving the problem, it at first seems as if it only holds for n 2 n \geq 2 , because A 1 A_1 and A 2 A_2 are both positive, and after that it flips signs (which is what ( 1 ) n (-1)^n does). It does hold for n = 1 n=1 because 2 n 3 2n-3 then suddenly becomes negative (canceling out the 1 -1 ), which is why I said 'surprisingly'.

Tim Vermeulen - 7 years, 10 months ago

Log in to reply

@Tim Vermeulen You used n = 1 n= 1 and n = 2 n= 2 as your base cases, so it should not be that surprising for you. :)

Sreejato Bhattacharya - 7 years, 10 months ago

Log in to reply

@Sreejato Bhattacharya Yup!

Tim Vermeulen - 7 years, 10 months ago

And n = 2 n = 2 .

Zhang Ning - 7 years, 10 months ago

Log in to reply

And n = 3 n=3 !

Cody Johnson - 7 years, 10 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...