cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Views

Author

César Eliud Lozada, Mar 04 2019

Keywords

Examples

			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.
		

Crossrefs

Programs

  • Maple
    #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
  • Mathematica
    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 *)