First, did you look at the suggested link by SPendulum: id:A002623 - OEIS Search Results
Next, you were asked to CLARIFY your problem; what does "3 elements" mean?
like, can 1,1,1 be used for a triangle? Or must all sides be different?
I guess by series you meant sequence(s). Also, you didn't bother to address how your question should be interpreted. The elements are side lengths I suppose? Is 1-1-1 a valid option, or do the side lengths have to be distinct?
simplependulum's formula was gotten through pretty advanced means and you're probably better off just seeing how to list them out, like Wilmer demonstrated. There's really no need to use the formula since the values are already given by Wilmer. But if you want to know what the symbols mean, google binomial coefficient and floor function.
First, did you look at the suggested link by SPendulum: id:A002623 - OEIS Search Results
Next, you were asked to CLARIFY your problem; what does "3 elements" mean?
like, can 1,1,1 be used for a triangle? Or must all sides be different?
Well, SPendulum gave you the CORRECT formula; it can also be written like this (C means Choose):
[2 * nC3 - nC2 + INT(n/2)] / 4 where n > 2
If n=10, substitute that in equation and answer will be 50
If n=20, substitute that in equation and answer will be 525
So answer to your problem is 525 - 50 = 475
If you can't follow that formula, not much can be done here.
I believe the formula is correct and my proof is briefly described in post#12 , for any z not exceeding n , count the possible lattice points (x<z,y<z) with contraints provided . If you have learnt Linear Programming , you will be familiar with this , but anyway i believe there is another easy proof as you desire ,I guess the technique is using bijection ?
Well simplependulum makes it sound easy, but I don't think I'm up for that; I'll try a different approach.
We can look for a recurrence relation; we will express T(n) in terms of T(n-1).
It is easy to verify that T(1)=T(2)=T(3)=0 and T(4)=1. So let's find the recurrence for n>4.
We will reason this way: T(n) - T(n-1) is going to count precisely those triangles that have n as the longest side. Why? Because if the longest side is less than n, then it is already counted in T(n-1). So let's count the triangles that have n as longest side, starting with n=5.
S(5)={1,2,3,4,5}
Let's call the shortest side a and the middle side b. Fix b=4=n-1. Then the triangle inequality tells us that . So possible a are {2,3}. What if we try to fix b=3? Then the inequality becomes and there are no possible a. So T(5) - T(4) = 2, as expected. (It's expected because we already listed out all the values earlier in this thread.)
Examine S(6)={1,2,3,4,5,6}. Fix b=5. Then a is in {2,3,4}. Fix b=4. Then a is in {3}. So T(6) - T(5) = 4, as expected.
If you continue the pattern you will notice we either have a sum of the form 2 + 4 + ... + (n-3) if n is odd or 1 + 3 + ... + (n-3) if n is even. So
if n odd, write n=2k+1, and we have
and if n even, write n=2k, and we have
So altogether we have
You could type this into PARI/GP as
Possibly this result could be used for an inductive proof of simplependulum's formula.Code:T(n)=if(n<4,0,if(n==4,1,if(n%2==1,T(n-1)+floor(n/2)*(floor(n/2)-1),T(n-1)+(n/2-1)^2)))
Let's try it , the first few terms should be true ( intuitively !! ) , then assume is odd , and
which we have , by the recurrence relation
because is even . Therefore , we conclude if is odd and is true , so is
I am confident it is also true for is even .
This method is rather clear and trustable comparied with mine because it is analytical while my method is geometrical , which makes ( i am sure ) everybody dizzy including me . I had to imagine a plane in my mind and only guessed the numbers in terms of to be summed up , I am confident to write this formula out just because i could make contrast to Wilmer's answer ...
I sure agree that Jashan should be satisfied with a listing of the possible triangles,
the number which then can be supported by the formula...
Quite easy to program a listing (sides a < b < c):
GET n
LOOP a FROM 1 TO n-2
LOOP b FROM a+1 TO n-1
LOOP c FROM b+1 TO n
IF a+b > c THEN count = count + 1
ENDLOOPS.
If n=6, you'd get these 7:
2,3,4
2,4,5
2,5,6
3,4,5
3,4,6
3,5,6
4,5,6
Agreed. It didn't occur to me to explain to the OP how to write a program. Practically speaking, if all we care about are the numbers and not how we get there, and if we care about minimizing the time/effort we spend to get the answer, then finding a recursive or closed-form solution is only really useful for calculating large values like T(100000).