my dog learned polymorphism
The moose likes Programming Diversions and the fly likes Chess numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Chess numbers" Watch "Chess numbers" New topic

Chess numbers

Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1888
I am trying to solve this problem but not able to.(Taken from Mathematical Circles(Russian experience)).
On 8x8 chess board, numbers from 1 to 64 are written . Each number is written exactly once.
Prove that you can always find one pair of adjacent squares(which share common edge) such that difference in their numbers is at least 5.

Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3025
Consider two squares (not necessarily adjacent) - one at (x1, y1), and the other at (x2, y2). The first point has number N1 and the second has number N2. The shortest path between them has length abs(x2-x1) + abs(y2-y1), if we only use horizontal moves or vertical moves. If we consider how N changes as we move from square to square, we know that average rate of change on a particular path must be avg = (N2 - N1)/(abs(x2-x1) + abs(y2-y1)).

Now, somewhere on the 64 squares there's a 1 and a 64. Let those be N1 and N2. What's the smallest possible value of avg? The numerator is clearly 63. The largest possible value for the denominator is if N1 and N2 are on opposite corners, which are 7 squares apart vertically, and 7 horizontally. So the smallest possible value of avg is 63/14 = 4.57. Since all individual changes in N must be integers, we know that at least one change must be 5 or greater. And at least one must be 4 or less.
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1888
Thanks. Got it.
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1036
Mike Simmons wrote:[minimum average difference between 1 and 64 must be > 4.]

Nice insight!

I had worked out a proof that starts with some number in the middle of the board and proves that the in placing the next so many numbers, you are forced to end up with two adjacent numbers that are more than 4 apart. I was dreading typing in all the verbiage for the proof.
Don't get me started about those stupid light bulbs.
subject: Chess numbers
It's not a secret anymore!