Forums

Can you solve it?

Sort:
LoekBergman

To find the number of rectangles that fit into the square you can use the formula (9-length) * (9 - width). If the length is unequal to the width you have to multiply this by 2.

Squares have the same length and width. Hence, will not be multiplied by two. If you then calculate the times such a square will fit, you see that with the even numbers you get an odd result:

(9 - 8) * (9 - 8) = 1

(9 - 6) * (9 - 6) = 9

(9 - 4) * (9 - 4) = 25

(9 - 2) * (9 - 2) = 49

That is happening an even number of times because the last number (8) is even, hence is the total number not odd but even.

rooperi

AH< OK< I see where I made my mistake. With squares I starded on a1 and moved accross files, then repeated ac cross ranks. I never realised that I would get duplicates, that's why my total was high too.

ozzie_c_cobblepot

Ok - for all the marbles - now who can come up with:

1. closed form for the number of rectangles on an nxn board.

2. closed form for the number of rectangles on an nxn board with more white than black.

LegoPirateSenior

1) n^2 * (n+1)^2 / 4

2) n^2 * (n+2)^2 / 32 for even n

I'd have to use some pencil and paper for odd n.

ozzie_c_cobblepot

Hey good job. Your #2 is significantly different from mine, and I don't even follow why it even works, but the first is the same.

LegoPirateSenior

Consider how many placements  off odd-length segments you can have on a horizontal segment of even length n:

  • 2 placements of segments (n-1) units long
  • 4 placements of segments (n-3) units long
  • ...
  • n-2 placements of segments 3 units long
  • n placements of segments 1 units long

There are n/2 of the above numbers, averaging (n+2)/2 each, hence the sum of these is n*(n+2)/4.

Each of these can be paired with one of n*(n+2)/4 vertical segments, so there are n*(n+2)*n*(n+2)/16 possible rectangles with both sides having odd length.

Half of these have more white squares than black, hence the answer:

n*n*(n+2)*(n+2)/32

Nazgulsauron

Loek, a quick glance makes me think it's 20. Rxh7+:

 

20. .. Bxh7 21. Rh1 with Rxh7 on the menu

20. .. Kxh7 21. Rh1+ Kg6 22. Qe6+ Rf6 23. Bxf5#

ozzie_c_cobblepot

Interesting. Thanks. Well-explained! :-)

LoekBergman

@JWestlake: Completely correct, it was the second line which was the game continuation. It was his move Qe6+ that I had overlooked.

LoekBergman

I had to think about the first closed form, even knowing the answer at forehand, but finally I managed to do it mathematically:

it boils down to ∑∑(n-i)*(n-j).

 

That looks complicated to me, but is actually very straightforward.

 

First I was puzzled how I could convert this into an algebraic notation, until I realized that it is already there:

 

the sum of all numbers from 1 till n is equal to n times that average:

 

n*((n+1)/2).

 

So can that formula be rewritten as twice the multiplication of the sum of all numbers from 1 to n, which is equal to the first formula posted by LegoPirateSenior.

For the second closed form I still have to think about it. Nice puzzles.

ozzie_c_cobblepot

Credit for the puzzles goes to @BayAreaChess over on our "sister" website, Facebook.

LoekBergman

Credit to you for not taking the credits.

I think I have solved the second closed form as well, although I come to the conclusion that there are two closed forms and three types of answers. One for the even numbers and two for the odd numbers.

I found this solution by analyzing the results of the product of:

(n + 1 – i) * ∑(n + 1 – j)

When you do this for only the odd numbers, then will the total sum of those compound additions equal to:

ix(j1 + j2 + j3 + j4)

 

That means that each odd number will appear for exactly half the number of n when n is even and for (n+1)/2 when n is odd.When you take a look at the summation you can then see that the number n will appear (n/2) times when n is even and (n +1)/2 times when n is odd. The 1 will appear also that amount of times. Furthermore is it well known that the sum of all odd numbers starting from 1 up to the last odd number is equal to the number of odd numbers squared.  That means that all odd numbers added is equal to (n/2)² when n is even and ((n+1)/2)² when n is odd.

This results in the two next functions, the first one for n is even and the second one for n is odd:

(1/4n² + 1/2n)² when n is even, and

(1/4n² + 1/2n + 1/4)² when n is odd.

The results of those formulas squared are all rectangles with an unequal number of squares. To find the number of rectangles with a majority of white squares, one has to divide the outcome of the squared formula by two.

The latter action is perfectly possible for all n, when n is even. For n = 2 is this result 2, for n = 4 18, for n = 6 72 and for 8 is off course 200. (The result of the formula for even numbers and n = 8 is 20 and 20²/2 = 200).

There is something odds going on with the formula of the odds. The result of that formula is namely equal to the summation of all odd numbers itself. Hence, is the result of the formula for odd numbers 1, 4, 9, 16, 25 etc. respectively. That means for instance that for n = 5 the outcome is of the first formula is 9. (If you substitute (n -1) in that formula, then is the outcome 1/4 * n². When you then realize that 7 is the fourth odd number and its result is equal to 1/4 * 8² and that translates to (2* fourth odd * 2 * fourth odd) then does it all make sense.)

The number of rectangles with a majority of white squares is in half of the cases even and in the other half then obviously odd.  The outcome for 3 is 8 and for 7 is 128, but it is not directly determinable for all odd numbers occuring at an odd rank in the series of odd numbers. It depends if there are more white or black fields in the total square from the start. Depending on that is the answer for instance n = 5 40 or 41. So you could got have the question in return if the overall square starts with a black or a white square? Could have been dangerous in other places and other times:

http://www.youtube.com/watch?v=Wpx6XnankZ8

LegoPirateSenior

@Loek - "To find the number of rectangles with a majority of white squares, one has to divide the outcome of the squared formula by two"

Alas, this is incorrect. A counterexample is a 3x3 board, white square in the center: while you do have 16 rectangles with uneven numbers of squares of each color, there are 10 with more white (5 rectangles 1x1 + 4 rectangles 3x1 + 1 rectangle 3x3) and 6 with more black (4 rectangles 1x1 + 2 rectangles 3x1).

LoekBergman

@LegoPirateSenior: You are correct that there are 10 rectangles with white squares in a white square centered board, therefor are there 6 rectangles with more white squares in a black square centered board. In total will you have 16 rectangles with more white squares then black squares, just as much rectangles with more black then white squares.

The would imply that one should not divide the result of the formulas squared and will the answer for n = 5 then be 81 and for n = 7 256 etc..

sisu
LoekBergman wrote:

Thanks. I was looking for the proper set of formulas as well, but could not find it. Then I thought using my current knowledge would be faster.

Anyhow, I do make mistakes as well. Can you find what my opponent did? I did not foresee it. Can you solve it?

 

Did this game get published in some magazine recently? My Danish friend visited in early January and had something like this position on the kitchen table. I think one of the other posters did D-g4Xg3 but Lxf5# is quicker ;)

LoekBergman

@Sisu: I hope not, because I played it myself against Heelerjong (and lost) on another chess site. Embarassed I would rather get known by my victories.

Matir

A QBasic program I wrote just now reports 1296 rects, with 120 having more whites than blacks. Here is the code:

 

CONST L = 8, B = 8

 

FOR x = 1 TO L

 FOR y = 1 TO B

  FOR i = x TO L

   FOR j = y TO B

    T = T + 1

    IF (x + y) MOD 2 THEN IF (i * j) MOD 2 THEN C = C + 1

NEXT j, i, y, x

 

PRINT T, C

Matir
I just got curious about larger boards, and tried 50*50 with my QBasic program. It says that there are 1625625 rects and 195000 with more white than black.
Matir

Now man, someone wrote a Java program for finding rects and he found 200 with more whites! Maybe I got something wrong with my program. Here is what it looks after being translated to Java:

 

public class RectFinder {

    final static int L=8,B=8;

public static void main(String[] args) {

   int x,y,i,j,c=0,t=0;

for (x=1;x<=L;x++) {

       for (y=1;y<=B;y++) {

   for (i=x;i<=L;i++) {

   for (j=y;j<=B;j++) {

   t++;

if ((((x+y)%2)==1)&&(((i*j)%2)==1)) c++;

}

}

}

}

System.out.println("Number of rectangles:"+t);

System.out.println("Number of rectangles with more whites than blacks:"+c);

}

}