A306678
Number of distinct triangles with prime sides and largest side = prime(n).
Original entry on oeis.org
1, 3, 4, 6, 7, 11, 13, 18, 21, 22, 29, 30, 37, 46, 53, 56, 60, 71, 75, 87, 101, 105, 118, 124, 123, 139, 157, 173, 193, 209, 186, 207, 219, 244, 241, 264, 277, 291, 318, 329, 344, 371, 373, 405, 433, 465, 447, 440, 474, 511, 545, 563, 597, 602, 623, 645
Offset: 1
For n=1, there is 1 triangle: {2, 2, 2}, with largest side prime(1) = 2.
For n=2, there are 3 triangles: {2, 2, 3}, {2, 3, 3}, {3, 3, 3}, with largest side prime(2) = 3.
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).
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).
-
#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:
# Alternative:
with(NumberTheory):
A306678:=proc(n)
local a,i,p;
if n=1 then
1
else
a:=0;
p:=ithprime(n);
for i from pi(nextprime((p-1)/2)) to n do
a:=a+i-pi(nextprime(p-ithprime(i)))+1;
od;
return a
fi;
end proc;
seq(A306678(n),n=1..56); # Felix Huber, Apr 19 2025
A306673
a(n) is the number of distinct, non-similar acute triangles with integer sides and largest side <= n.
Original entry on oeis.org
1, 2, 4, 7, 12, 16, 26, 34, 46, 56, 76, 90, 116, 135, 161, 187, 229, 257, 308, 344, 394, 439, 511, 558, 636, 698, 779, 849, 959, 1027, 1152, 1245, 1362, 1465, 1603, 1703, 1874, 2004, 2164, 2298, 2507, 2639, 2867, 3034, 3235, 3421, 3690, 3866, 4147, 4354
Offset: 1
For n=4, there are 9 acute triangles with integer sides and largest side <= 4. These have sides {a,b,c} = {1, 1, 1}, {1, 2, 2}, {1, 3, 3}, {1, 4, 4}, {2, 2, 2}, {2, 2, 4}, {2, 3, 3}, {3, 3, 4}, {3, 4, 4}. But {2, 2, 2} is similar to {1,1,1} and {2,2,4} is similar to {1,1,2}, so these two triangles are excluded from the list and therefore a(4)=7.
-
#nType=1 for acute triangles, nType=2 for obtuse triangles, nType=0 for both triangles
CountTriangles := proc (n, nType := 1)
local aa, oo, a, b, c, tt, lAcute;
aa := {}; oo := {};
for a from n by -1 to 1 do for b from a by -1 to 1 do for c from b by -1 to 1 do
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 and gcd(a, gcd(b, c)) = 1 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 end do;
return sort(`if`(nType = 1, aa, `if`(nType=2,oo,`union`(aa,oo))))
end proc
-
Length@Select[DeleteDuplicates[Sort@# & /@ Tuples[Range@#, 3]], GCD @@ # == 1 && #[[1]] + #[[2]] > #[[3]] && #[[1]]^2 + #[[2]]^2 > #[[3]]^2 &] & /@ Range@50 (* Hans Rudolf Widmer, Dec 07 2023 *)
A306676
Number of distinct acute triangles with prime sides and largest side = prime(n).
Original entry on oeis.org
1, 2, 3, 5, 5, 8, 9, 11, 13, 12, 18, 17, 21, 27, 30, 28, 30, 38, 38, 43, 56, 53, 59, 59, 56, 64, 79, 85, 100, 106, 79, 90, 96, 115, 102, 123, 124, 130, 144, 147, 152, 177, 161, 188, 199, 225, 193, 175, 195, 228, 248, 247, 280, 259, 267, 277, 288, 324
Offset: 1
For n=3, prime(n)=5. Acute triangles: {2,5,5}, {3,5,5}, {5,5,5} (Total=3=a(3)).
For n=4, prime(n)=7. Acute triangles: {2,7,7}, {3,7,7}, {5,5,7}, {5, 7, 7}, {7, 7, 7} (Total=5=a(4)).
-
#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:
A306677
Number of distinct obtuse triangles with prime sides and largest side = prime(n).
Original entry on oeis.org
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
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.
-
#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:
Showing 1-4 of 4 results.