[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
|
|
Problem DescriptionPut 3 marbles in a triangle and place a 4th marble on top. You have just built a triangular based pyramid, also called a tetrahedron. If you started with 6 marbles and placed a second layer of 3 and then one on top, you have another tetrahedron with 3 layers and 10 marbles. The two layer tetrahedron contains 4 marbles, a perfect square(4=22). Can you find the next tetrahedron whose total number of marbles is a perfect square? Background & TechniquesOnly about 10 lines of code in this one. Starting with a one marble pyramid, we'll just generate the total for each pyramid from the previous one. And stop when the square root of the total is an integer. I put an upper limit of 1000 marbles per side, just in case there weren't any small solutions. We don't want the program to loop forever. Notice that each layer contains the number of marbles in the previous layer plus the layer number additional. And the total is just the previous total plus the number in this layer.
Running/Exploring the Program
Suggestions for Further Explorations
|
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 2000-2018, Gary Darby All rights reserved. |