I was just too curious with finding a formula that gives the maximum number of triangles that can be formed from a triangle stack, which looks just like the playing cards stacked in a triangular fashion one above the other. So here it goes........
As an example i am using a equilateral triangle containing in itself a repeated ordered set of triangles as shown below.
And this is a triangle of level 3.
So now the formula for finding number of triangles(NOFT) that can be formed in a triangle of level X is given by
NOFT(X) = 2*NOFT(X-1) - NOFT(X-2) + (3*X-X%2)/2
Using the formula for level 2 we get,
NOFT(2) = 2*NOFT(1) - NOFT(0) + (3*2-2%2)/2
----------------------here the values for NOFT(1)= 1 and NOFT(0)= 0
NOFT(2) = 2*1-0+(6-0)/2 = 2+3 = 5
The results for different levels are tabulated below
Level No of possible triangles(using the formula)
0 0(default value)
1 1 (default value)
2 2 *1-0+(3*2-2%2)/2 = 2-0+ (6-0)/2 = 5
3 2*5-1+(3*3-3%2)/2 = 10-1+(9-1)/2 = 13
4 2*13-5+(3*4-4%2)/2 = 26-5+(12-0)/2=27
and the rest follows................. :)
No comments:
Post a Comment