Triangle Numbers | ||
---|---|---|
Rows | Triangle(Rows) | Formula |
1 | 1 | base case |
2 | 3 | 2 + Triangle(1) |
3 | 6 | 3 + Triangle(2) |
4 | 10 | 4 + Triangle(3) |
5 | 15 | 5 + Triangle(4) |
6 | 21 | 6 + Triangle(5) |
7 | 28 | 7 + Triangle(6) |
The table shows values of the Triangle()
function.
For example, Triangle(4) = 10
.
But it stops at seven. What is Triangle(12)
?
We have figured out that the following is true:
total number of pins in N rows = number of pins in row N + total number of pins in N-1 rows = N + total number of pins in N-1 rows
This can be written as a formula:
Triangle( N ) = N + Triangle( N - 1 )
So the number of pins in a
How many pins are in 11 rows?