Relationship between the number of triangles and the perimeter