A306677 Number of distinct obtuse triangles with prime sides and largest side = prime(n).
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, 78, 88, 93, 103, 107, 117, 123, 129, 139, 141, 153, 161, 174, 182, 192, 194, 212, 217, 234, 240, 254, 265, 279, 283, 297, 316, 317, 343, 356, 368, 380, 382, 404
Offset: 1
Keywords
Examples
For n=5, prime(n)=11. Triangles: {5, 7, 11}, {7, 7, 11}, so a(5) = 2. For n=6, prime(n)=13. Triangles: {3, 11, 13}, {5, 11, 13}, {7, 7, 13}, so a(6)=3.
Programs
-
Maple
#nType=1 for acute triangles, nType=2 for obtuse triangles #nType=0 for both triangles CountPrimeTriangles := proc (n, nType := 1) local aa, oo, j, k, sg, a, b, c, tt, lAcute; aa := {}; oo := {}; a := ithprime(n); for j from n by -1 to 1 do b := ithprime(j); for k from j by -1 to 1 do c := ithprime(k); 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 lAcute := evalb(0 < b^2+c^2-a^2); tt := sort([a, b, c]); if lAcute then aa := {op(aa), tt} else oo := {op(oo), tt} end if end if end do end do; return sort(`if`(nType = 1, aa, `if`(nType = 2, oo, `union`(aa, oo)))) end proc: