login
Number of scalene triangles whose vertices are the vertices of a regular n-gon.
1

%I #34 Aug 20 2021 17:05:54

%S 0,0,0,12,14,32,54,80,110,168,208,280,360,448,544,684,798,960,1134,

%T 1320,1518,1776,2000,2288,2592,2912,3248,3660,4030,4480,4950,5440,

%U 5950,6552,7104,7752,8424,9120,9840,10668,11438,12320,13230,14168,15134,16224,17248

%N Number of scalene triangles whose vertices are the vertices of a regular n-gon.

%C The number of scalene triangles equals (number of triangles, i.e., binomial(n,3)) - (number of isosceles triangles).

%C The general formula is readily proved true by counting arguments.

%H Colin Barker, <a href="/A330197/b330197.txt">Table of n, a(n) for n = 3..1000</a>

%H <a href="/index/Rec#order_10">Index entries for linear recurrences with constant coefficients</a>, signature (0,2,2,-1,-4,-1,2,2,0,-1).

%F a(n) = binomial(n,3) - A320577(n).

%F a(n) = C(n,3)-n*(n-1)/2 if n mod 6 = 1 or 5; C(n,3)-n*(n-2)/2 if n mod 6 = 2 or 4; C(n,3)-n*(3*n-7)/6 if n mod 6 = 3; C(n,3)-n*(3*n-10)/6 otherwise [C(n,k) denoting binomial coefficients].

%F G.f.: 2*x^6*(2+x)*(3+x*(2+x))/((x-1)^4*(x+1)^2*(1+x+x^2)^2).

%F a(n) = 2*a(n-2) + 2*a(n-3) - a(n-4) - 4*a(n-5) - a(n-6) + 2*a(n-7) + 2*a(n-8) - a(n-10) for n>12. - _Colin Barker_, Jan 08 2020

%e Trivial cases:

%e a(3)=0 since the only triangle formed by joining vertices is equilateral.

%e a(4)=a(5)=0 since all such triangles are isosceles.

%e For higher n, since a triangle is formed by choosing 3 vertices and joining them, there are C(n,3) such triangles. To obtain the number of scalene triangles, subtract the number of isosceles triangles (A320577).

%t a[n_] := If[Mod[n,6]==1 || Mod[n,6]==5, Binomial[n,3]-Binomial[n,2], If[Mod[n,6]==2 || Mod[n,6]==4, Binomial[n,3]-n*(n-2)/2,

%t If[Mod[n, 6]==3, Binomial[n,3]-n*(3*n-7)/6, Binomial[n,3]-n*(3*n - 10)/6]]]; Array[a, 20, 3]

%t LinearRecurrence[{0,2,2,-1,-4,-1,2,2,0,-1},{0,0,0,12,14,32,54,80,110,168},50] (* _Harvey P. Dale_, Aug 20 2021 *)

%o (Python)

%o from sympy import binomial

%o def a(n):

%o assert (n>=3),"Sequence a(n) defined for n>=3"

%o m = n % 6

%o Cn3 = binomial(n, 3)

%o if m in [1,5]: return Cn3 - (n*(n-1))//2

%o elif m in [2,4]: return Cn3 - (n*(n-2))//2

%o elif m==3: return Cn3 - (n*(3*n-7))//6

%o else: return Cn3 - (n*(3*n-10))//6

%o print([a(k) for k in range(3,51)])

%o (PARI) concat([0,0,0], Vec(2*x^6*(2 + x)*(3 + 2*x + x^2) / ((1 - x)^4*(1 + x)^2*(1 + x + x^2)^2) + O(x^60))) \\ _Colin Barker_, Jan 08 2020

%Y Cf. A320577 (isosceles triangles).

%K nonn,easy

%O 3,4

%A _Adam Vellender_, Dec 05 2019