Блог пользователя __T_H_O_R__

Автор __T_H_O_R__, история, 6 лет назад, По-английски

Question: You are given n sticks of lengths 1 to n unit respectively. Using three different sticks how many different triangles can you form?

I have found a formula on the internet. That is if n is odd triangle=(n-1)*(n-3)*(2n-1)/24 else triangle=n*(n-2)*(2n-5)/24

But I could not prove this or find any proof. Can anyone provide with a proof of this formula? How to derive this? Or share if there are other ways to solve this problem? Thanks in advance.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, # |
Rev. 6   Проголосовать: нравится 0 Проголосовать: не нравится

It can be proved by induction.
For n = 4 the number is 1. For n = n0 + 1, if n0 is odd then the number is ; if n0 is even then the number is ; in both cases the first term is the number of triangles with lengthes  ≤ n0 and the second term is the number of triangles with one length that equal to n. By simplifying expressions, you can get needed formula

  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    For n = 4 the number is 3.

    So we're assuming degenerate triangles are allowed? Otherwise I think the only valid triples is {2, 3, 4}. In fact, the given formula n(n - 2)(2n - 5) / 24 gives 1 as well.