Consider a 6 by 6 grid of random, base 10 integers, uniformly distributed between 1 and 99, such as in
"Another Square". Construct a second grid where the content of each cell in the second grid is the sum of the orthogonal neighbors of its corresponding cell from the first grid.
What is the probability that a given number in the second grid is a perfect square?
If the grids were infinite, what is the probability that a given number in the second grid would be a perfect square?
Program below has bug; see later comment.
DEFDBL AZ
FOR a = 1 TO 99
FOR b = 1 TO 99
sq2 = a + b
sr2 = INT(SQR(sq2) + .5)
IF sr2 * sr2 = sq2 THEN ct2 = ct2 + 1
FOR c = 1 TO 99
sq3 = sq2 + c
sr3 = INT(SQR(sq3) + .5)
IF sr3 * sr3 = sq3 THEN ct3 = ct3 + 1
FOR d = 1 TO 99
sq4 = sq3 + d
sr4 = INT(SQR(sq4) + .5)
IF sr4 * sr4 = sq4 THEN ct4 = ct4 + 1
NEXT
NEXT
NEXT
NEXT
PRINT sq2, sq2 / (99 * 99)
PRINT sq3, sq3 / (99# * 99 * 99)
PRINT sq4, sq4 / (99# * 99 * 99 * 99)
finds
198 .0202020202020202
297 3.060912151821243D04
396 4.122440608513458D06
which means that 198 out of 99^2 cases of the possible choices of two randoms from 1 to 99 were perfect squares; 297/(99^3) for the sum of three random integers; and 396/(99^4) for the sum of four random cubes.
The second grid has four positions (the corners) that represent the sum of two integers, 16 that represent the sum of three integers (the edges not at corners), and 16 (the 4x4 center) that represent the sum of four random integers.
So for the grid as presented we need the weighted average:
(4/36)*198/(99^2) + (16/36)*297/(99^3) + (16/36)*396/(99^4) = 20806/8732691, or about 0.002382541647242528.
For the infinite board, all the positions represent the sum of four integers, and so the probability for each is 396/(99^4) = 4/970299 ~= 0.0000041224406085134.
Edited on August 20, 2010, 5:23 pm

Posted by Charlie
on 20100819 21:35:01 