%I #17 May 03 2019 19:27:53
%S 1,3,4,6,7,11,13,18,21,22,29,30,37,46,53,56,60,71,75,87,101,105,118,
%T 124,123,139,157,173,193,209,186,207,219,244,241,264,277,291,318,329,
%U 344,371,373,405,433,465,447,440,474,511,545,563,597,602,623,645
%N Number of distinct triangles with prime sides and largest side = prime(n).
%F a(n) = A306676(n) + A306677(n).
%e For n=1, there is 1 triangle: {2, 2, 2}, with largest side prime(1) = 2.
%e For n=2, there are 3 triangles: {2, 2, 3}, {2, 3, 3}, {3, 3, 3}, with largest side prime(2) = 3.
%e For n=4, there are 6 triangles :{2, 7, 7}, {3, 5, 7}, {3, 7, 7}, {5, 5, 7}, {5, 7, 7}, {7, 7, 7}, with largest side prime(4) = 7. Total = 6 = a(4).
%e For n=5, largest side = prime(n) = 11. Triangles are {{2, 11, 11}, {3, 11, 11}, {5, 7, 11}, {5, 11, 11}, {7, 7, 11}, {7, 11, 11}, {11, 11, 11}}. Total = 7 = a(5).
%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, A306677.
%K nonn
%O 1,2
%A _César Eliud Lozada_, Mar 04 2019