Is there any formula than calculates the total number of squares on chessboard?
For example in a 8×8 chessboard, there are squares of sizes 1×1, 2×2, …, 8×8.
So I want to know their total number. Is there a general formula for a n×n chessboard?
Answer
There are
12+22+32+42+52+62+72+82=204 squares on an 8×8 board.
In the general case, the number of squares is 12+⋯+n2 for an n×n board,
or equivalently, nk=1∑ k2.As @M Oehm noted, a Faulhaber formula lets us simplify this to n(n+1)(2n+1)6.
This is because ...
For 1×1 squares, there are obviously n2 of them.
You can fit (n−1) rows of 2×2 squares in an n2 area, and each row has (n−1) in it.
You can fit (n−2) rows of 3×3 squares in an n2 area, and each row has (n−2) in it.
...
You can fit 2 rows of (n−1)×(n−1) squares in an n2 area, and each row has 2 in it.
And finally, of course, you can fit 1 (n×n) square in an n2 area.This expands to
n2+(n−1)2+⋯+22+12= nk=1∑ k2= n(n+1)(2n+1)6.
No comments:
Post a Comment