I
I
Ivan2014-04-13 21:13:26
Programming
Ivan, 2014-04-13 21:13:26

How many triangles are in the picture?

be2ddc49554e47798caa52830b895799.png
How, knowing the length of the side of such a triangle, to find the number of triangles depicted (for the example above, the answer is 13)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Vasiliev, 2014-04-13
@0neS

FOR DESCENDANTS: do not believe everything that is written on the Internet! this solution is wrong!
When the side of the triangle is increased by 1
C(i+1) =
C(i) /* all triangles of the previous figure (which has side i) */
+ 2i+1 /* triangles with side 1, drawn to one of the sides of the previous figure* /
+ i /* triangles with side 2 overlapping the previous one by 1 */
+ i-1 /* triangles with side 3 overlapping the previous one by 2*/
+ i-2 /* triangles with side 4 overlapping the previous one by 3*/
+ etc. up to zero (i.e. up to ii)

S
Sergey Lerg, 2014-04-13
@Lerg

It is interesting to look at the graph of such dependence.

M
Mrrl, 2014-04-28
@Mrl

If you look for the answer in the form of a formula, then [n*(n+2)*(2*n+1)/8]
There, for even and odd n, different series are obtained, so you have to take the integer part (or be smart with (-1) ^n).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question