If, however, the similarity function satisfies the triangle inequality then it is possible to use the result of each comparison to prune the set of candidates to be examined.
The -inframetric inequality implies the -relaxed triangle inequality (assuming the first axiom), and the -relaxed triangle inequality implies the 2-inframetric inequality.
So the number of integer triangles (up to congruence) with perimeter "p" is the number of partitions of "p" into three positive parts that satisfy the triangle inequality.