login
Number of distinct obtuse triangles with prime sides and largest side = prime(n).
4

%I #11 May 03 2019 19:24:15

%S 0,1,1,1,2,3,4,7,8,10,11,13,16,19,23,28,30,33,37,44,45,52,59,65,67,75,

%T 78,88,93,103,107,117,123,129,139,141,153,161,174,182,192,194,212,217,

%U 234,240,254,265,279,283,297,316,317,343,356,368,380,382,404

%N Number of distinct obtuse triangles with prime sides and largest side = prime(n).

%e For n=5, prime(n)=11. Triangles: {5, 7, 11}, {7, 7, 11}, so a(5) = 2.

%e For n=6, prime(n)=13. Triangles: {3, 11, 13}, {5, 11, 13}, {7, 7, 13}, so a(6)=3.

%p #nType=1 for acute triangles, nType=2 for obtuse triangles

%p #nType=0 for both triangles

%p CountPrimeTriangles := proc (n, nType := 1)

%p local aa, oo, j, k, sg, a, b, c, tt, lAcute;

%p aa := {}; oo := {};

%p a := ithprime(n);

%p for j from n by -1 to 1 do

%p b := ithprime(j);

%p for k from j by -1 to 1 do

%p c := ithprime(k);

%p if a < b+c and abs(b-c) < a and b < c+a and abs(c-a) < b and c < a+b and abs(a-b) < c then

%p lAcute := evalb(0 < b^2+c^2-a^2);

%p tt := sort([a, b, c]);

%p if lAcute then aa := {op(aa), tt} else oo := {op(oo), tt} end if

%p end if

%p end do

%p end do;

%p return sort(`if`(nType = 1, aa, `if`(nType = 2, oo, `union`(aa, oo))))

%p end proc:

%Y Cf. A306673, A306674, A306676, A306678.

%K nonn

%O 1,5

%A _César Eliud Lozada_, Mar 04 2019