Take a standard 8x8 chessboard, number the black squares 1 and the white squares 0. How many palindromes does this board contain in 'word-search' fashion?
Now generalize and find a formula for any n*n board.
Notes: A palindrome and its reversal should not be counted twice. A palindrome must be at least two digits long and leading zeroes are not allowed. Numbers can be read in any single vertical, horizontal or diagonal direction.
The first part of the solution is that there are 236 palindromes in an 8x8 grid.
Part of the second is the following 'rough' formula for the number of palindromes formed within diagonals:
1/12(4(N^3)-6(N^2)+2N+6((-1)^N-1)(N-1)
For the 8x8 there are 140 palindromes within the diagonals. Plug in 8 as N to get:
1/12(4(512)-6(64)+2(8)+(0)
1/12(2048-384+16)
1/12(1680)
=140 diagonal palindromes
|
Posted by Justin
on 2006-06-10 17:30:17 |