It turns out that there are names for each of the numbers we worked with in this program. The number of marbles in each layer are triangular numbers . And the total number of marbles in each pyramid is a tetrahedral number . The solution found here is the largest one. And, as you might suspect, there are algorithms to compute the millionth tetrahedral number without computing the first 999,999.
Triangular numbers have interesting properties worthy of further study.
For example, the 3rd triangular number from the table above is 6. See Permutes2 program for more discussion of combinations . Intellitech Systems Inc. All rights reserved.