Problem 1172. Wheat on a chessboard pt 1
If a chessboard were to have wheat placed upon each square such that one grain were placed on the first square and each successive square after had double the amount of grains as the square before. How many grains of wheat would be on the chessboard at the finish?
Assume the chess board is n by n squares.
Solution Stats
Problem Comments
-
7 Comments
Show
4 older comments
Prateep Mukherjee
on 8 Jan 2013
actually you need to use isequalwithequalnans
Jan Orwat
on 11 Apr 2014
tests 5 and 6 does not work properly. those numbers are out of precision, and for test 6 it couldn't be fixed even with uint64 used instead of type double
Massimo Zanetti
on 19 Oct 2016
This problem is simply wrong. The right answer is
sum(1:2^(n^2-1))
if we where to sum ALL the grains on the board....
Solution Comments
Show commentsGroup

Board Games I
- 16 Problems
- 21 Finishers
- The Tower of Hanoi
- hanoi towers II
- Eight Queens Solution Checker
- N-Queens Checker
- Wheat on a chessboard pt 1
- Wheat on a chessboard pt 2
- Identify Reachable Points
- Valid Chess Moves
- Chess probability
- Chess performance
- Chess ELO rating system
- Pentago: find winning move
- Go-style solver
- Game of Nim
- RISK board game battle simulation
- RISK Calculator - Large Armies, High Accuracy, Fast
Problem Recent Solvers184
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!