> # chess_so(lution).mws
 

John Cosgrave, Mathematics Dept., St. Patrick's College,
                          Drumcondra, Dublin 9, IRELAND.
 

email: John.Cosgrave@spd.ie 

web site: http://www.spd.dcu.ie/johnbcos 

 

Solution to the chess board problem
(see
An Introduction to Inequalities for first year students) 

 

The immediate motivation for what follows is the chess board problem (the versus problem), detailed in an earlier talk. 

 

For sequences and  finite series I will adopt the following notations: 

 

 

 

 

 

First, I demonstrate a crude approach to finding and (I am deliberately avoiding the use of Maple's readymade commands add or sum): 

 

Option One (where the number of grains of wheat on the square is ). I begin with '5' in the third program line to see some early outputs for the eye to check (as a way of feeling that the program has been correctly written), but then I copy, paste, change the semi-colons to colons, and re-execute. 

 

Program 1. 

> a[1] := 2^(1-1);
t[1] := a[1];
for k from 2 to 5 do
a[k] := 2^(k-1);
t[k] := t[k-1] + a[k];
od;
 

 

 

 

 

 

 

 

 

 

1
1
2
3
4
7
8
15
16
31 (1)
 

>
 

Program 2. 

> a[1] := 2^(1-1):
t[1] := a[1]:
for k from 2 to 64 do
a[k] := 2^(k-1):
t[k] := t[k-1] + a[k]:
od:
 

> t[64];
 

18446744073709551615 (2)
 

And if you really want to check using Maple's add command: 

> add(2^(k-1), k=1..64);
 

18446744073709551615 (3)
 

>
 

And now to compute :
Program 3.
 

> A[1] := 100000000000000;
T[1] := A[1];
for k from 2 to 5 do
A[k] := k*100000000000000;
T[k] := T[k-1] + A[k];
od;
 

 

 

 

 

 

 

 

 

 

100000000000000
100000000000000
200000000000000
300000000000000
300000000000000
600000000000000
400000000000000
1000000000000000
500000000000000
1500000000000000 (4)
 

>
 

Program 4. 

> A[1] := 100000000000000:
T[1] := A[1]:
for k from 2 to 64 do
A[k] := k*100000000000000:
T[k] := T[k-1] + A[k]:
od:
 

> T[64];
 

208000000000000000 (5)
 

>
 

Again, resorting to Maple's add command: 

> add(k*100000000000000, k=1..64);
 

208000000000000000 (6)
 

>
 

And which is the greater, or ? Well, let's see them one after the other: 

> t[64];
 

18446744073709551615 (7)
 

> T[64];
 

208000000000000000 (8)
 

>
 

And we see (which should come as no surprise, otherwise the story would have little point) that Option One - the - produces the largest total. 

 

So, where did the switch round occur, and, having switched, did it continue in favour of the Option One partial totals the whole way to the square? 

 

Of course the partial totals for Option Two are the greater in the early stages:
Program 5.
 

> for k to 10 do
if t[k] < T[k]
then print(k, t[k], T[k])
fi
od;
 

 

 

 

 

 

 

 

 

 

1, 1, 100000000000000
2, 3, 300000000000000
3, 7, 600000000000000
4, 15, 1000000000000000
5, 31, 1500000000000000
6, 63, 2100000000000000
7, 127, 2800000000000000
8, 255, 3600000000000000
9, 511, 4500000000000000
10, 1023, 5500000000000000 (9)
 

>
 

But the partial totals for Option Two are not the greater in the latter stages: 

 

Program 6. 

> for k from 60 to 64 do
if t[k] < T[k]
then print(k, t[k], T[k])
fi
od;
 

>
 

Important Note. There was NO output when I executed that last program, telling us that those last five t 's were not less than the corresponding T 's (but that doesn't mean the t 's were greater, since equality could have occurred for one or more of them with the corresponding T 's). 

 

Of course one could slightly alter Program 6 to:

Program 7.
 

> for k from 60 to 64 do
if t[k] > T[k]
then print(k, t[k], T[k])
fi
od;
 

 

 

 

 

60, 1152921504606846975, 183000000000000000
61, 2305843009213693951, 189100000000000000
62, 4611686018427387903, 195300000000000000
63, 9223372036854775807, 201600000000000000
64, 18446744073709551615, 208000000000000000 (10)
 

>
 

But best of all is perhaps:

Program 8 (here the extras for you to note are:
 

 

 

 

. 

> for k to 64 do
if t[k] < T[k]
then lprint(k, t[k], T[k], `The larger partial total comes from Option One`)
elif t[k] = T[k]
then lprint(k, t[k], T[k], `The options produce the same totals`)
elif t[k] > T[k]
then lprint(k, t[k], T[k], `Oh!!! Option One gives the larger partial total`)
fi
od;
 

1, 1, 100000000000000, `The larger partial total comes from Option One`
 

2, 3, 300000000000000, `The larger partial total comes from Option One`
3, 7, 600000000000000, `The larger partial total comes from Option One`
4, 15, 1000000000000000, `The larger partial total comes from Option One`
5, 31, 1500000000000000, `The larger partial total comes from Option One`
6, 63, 2100000000000000, `The larger partial total comes from Option One`
7, 127, 2800000000000000, `The larger partial total comes from Option One`
8, 255, 3600000000000000, `The larger partial total comes from Option One`
9, 511, 4500000000000000, `The larger partial total comes from Option One`
10, 1023, 5500000000000000, `The larger partial total comes from Option One`
11, 2047, 6600000000000000, `The larger partial total comes from Option One`
12, 4095, 7800000000000000, `The larger partial total comes from Option One`
13, 8191, 9100000000000000, `The larger partial total comes from Option One`
14, 16383, 10500000000000000, `The larger partial total comes from Option One`
15, 32767, 12000000000000000, `The larger partial total comes from Option One`
16, 65535, 13600000000000000, `The larger partial total comes from Option One`
17, 131071, 15300000000000000, `The larger partial total comes from Option One`
18, 262143, 17100000000000000, `The larger partial total comes from Option One`
19, 524287, 19000000000000000, `The larger partial total comes from Option One`
20, 1048575, 21000000000000000, `The larger partial total comes from Option One`
21, 2097151, 23100000000000000, `The larger partial total comes from Option One`
22, 4194303, 25300000000000000, `The larger partial total comes from Option One`
23, 8388607, 27600000000000000, `The larger partial total comes from Option One`
24, 16777215, 30000000000000000, `The larger partial total comes from Option One`
25, 33554431, 32500000000000000, `The larger partial total comes from Option One`
26, 67108863, 35100000000000000, `The larger partial total comes from Option One`
27, 134217727, 37800000000000000, `The larger partial total comes from Option One`
28, 268435455, 40600000000000000, `The larger partial total comes from Option One`
29, 536870911, 43500000000000000, `The larger partial total comes from Option One`
30, 1073741823, 46500000000000000, `The larger partial total comes from Option One`
31, 2147483647, 49600000000000000, `The larger partial total comes from Option One`
32, 4294967295, 52800000000000000, `The larger partial total comes from Option One`
33, 8589934591, 56100000000000000, `The larger partial total comes from Option One`
34, 17179869183, 59500000000000000, `The larger partial total comes from Option One`
35, 34359738367, 63000000000000000, `The larger partial total comes from Option One`
36, 68719476735, 66600000000000000, `The larger partial total comes from Option One`
37, 137438953471, 70300000000000000, `The larger partial total comes from Option One`
38, 274877906943, 74100000000000000, `The larger partial total comes from Option One`
39, 549755813887, 78000000000000000, `The larger partial total comes from Option One`
40, 1099511627775, 82000000000000000, `The larger partial total comes from Option One`
41, 2199023255551, 86100000000000000, `The larger partial total comes from Option One`
42, 4398046511103, 90300000000000000, `The larger partial total comes from Option One`
43, 8796093022207, 94600000000000000, `The larger partial total comes from Option One`
44, 17592186044415, 99000000000000000, `The larger partial total comes from Option One`
45, 35184372088831, 103500000000000000, `The larger partial total comes from Option One`
46, 70368744177663, 108100000000000000, `The larger partial total comes from Option One`
47, 140737488355327, 112800000000000000, `The larger partial total comes from Option One`
48, 281474976710655, 117600000000000000, `The larger partial total comes from Option One`
49, 562949953421311, 122500000000000000, `The larger partial total comes from Option One`
50, 1125899906842623, 127500000000000000, `The larger partial total comes from Option One`
51, 2251799813685247, 132600000000000000, `The larger partial total comes from Option One`
52, 4503599627370495, 137800000000000000, `The larger partial total comes from Option One`
53, 9007199254740991, 143100000000000000, `The larger partial total comes from Option One`
54, 18014398509481983, 148500000000000000, `The larger partial total comes from Option One`
55, 36028797018963967, 154000000000000000, `The larger partial total comes from Option One`
56, 72057594037927935, 159600000000000000, `The larger partial total comes from Option One`
57, 144115188075855871, 165300000000000000, `The larger partial total comes from Option One`
58, 288230376151711743, 171100000000000000, `Oh!!! Option One gives the larger partial total`
59, 576460752303423487, 177000000000000000, `Oh!!! Option One gives the larger partial total`
60, 1152921504606846975, 183000000000000000, `Oh!!! Option One gives the larger partial total`
61, 2305843009213693951, 189100000000000000, `Oh!!! Option One gives the larger partial total`
62, 4611686018427387903, 195300000000000000, `Oh!!! Option One gives the larger partial total`
63, 9223372036854775807, 201600000000000000, `Oh!!! Option One gives the larger partial total`
64, 18446744073709551615, 208000000000000000, `Oh!!! Option One gives the larger partial total`
 

>
 

The above is all very well, but it is a long way from doing Mathematics... We need to get down to fundamentals: to recognising the true nature of what we have been doing above. So we need to study: 

 

 

 

 

 

>