Triangles with rational side lengths This challenge will have give you a positive integer \$n\$ and ask you to output \$t(n)\$, the number of triangles (up to congruence) satisfying the three conditions:

The triangles have perimeter of 1,
the triangles have side lengths \$\displaystyle\frac{a_1}{b_1}, \frac{a_2}{b_2}\$, and \$\displaystyle\frac{a_3}{b_3}\$, and
when written in lowest terms, \$\max \{b_1, b_2, b_3\} = n\$.

Examples
For \$n = 2\$, there are no such triangles, so \$t(2) = 0\$.
For \$n = 3\$, there is one such triangle, so \$t(3) = 1\$:
$$
  \frac{a_1}{b_1} = \frac{a_2}{b_2} = \frac{a_3}{b_3} = \frac 1 3
$$
For \$n = 4\$, there are no such triangles, so \$t(4) = 0\$.
For \$n = 5\$, there is one such triangle, so \$t(5) = 1\$:
$$
  \left(\frac{a_1}{b_1}, \frac{a_2}{b_2}, \frac{a_3}{b_3}\right) = 
  \left(\frac 1 5, \frac 2 5, \frac 2 5\right)
$$
For \$n = 6\$, there are no such triangles, so \$t(6) = 0\$.
For \$n = 7\$, there are two such triangles, so \$t(7) = 2\$:
$$
  \left(\frac{a_1}{b_1}, \frac{a_2}{b_2}, \frac{a_3}{b_3}\right) = 
  \left(\frac 2 7, \frac 2 7, \frac 3 7\right) 
  \hspace{1em} \text{and} \hspace{1em}
  \left(\frac{a_1}{b_1}, \frac{a_2}{b_2}, \frac{a_3}{b_3}\right) = 
  \left(\frac 1 7, \frac 3 7, \frac 3 7\right)
$$
For \$n = 8\$, there is one such triangle, so \$t(8) = 1\$:
$$
  \left(\frac{a_1}{b_1}, \frac{a_2}{b_2}, \frac{a_3}{b_3}\right) = 
  \left(\frac 1 4, \frac 3 8, \frac 3 8\right)
$$
The first thirty pairs, \$\left(n, t(n)\right)\$ are:
(1,0),(2,0),(3,1),(4,0),(5,1),(6,0),(7,2),(8,1),(9,2),(10,1),(11,4),(12,2),(13,5),(14,2),(15,5),(16,4),(17,8),(18,4),(19,10),(20,8),(21,10),(22,6),(23,14),(24,8),(25,15),(26,9),(27,16),(28,14),(29,21),(30,13)


This is a code-golf challenge, so shortest code wins.
JavaScript (ES6),  188 184  183 bytes

n=&gt;{for(o=r=[],a=n;x=--a/n;)for(P=n;P;P--)for(p=P;y=--p/P;)for(Q=n;Q;)!(z=Q-x*Q-y*Q,g=(a,b)=&gt;b?g(b,a%b):z%1||a&gt;1)(a,n)&amp;!o[k=[x,y,z/=Q--].sort()]&amp;x+y&gt;z&amp;x+z&gt;y&amp;y+z&gt;x?o[k]=++r:0;return+r}

Try it online!
How?
Given \$n\$, we look for all pairs \$(x,y)\$ defined as:
$$x=\dfrac{a}{n},\:1\le a &lt;n$$
$$y=\dfrac{p}{P},\:1\le p &lt; P \le n$$
For each pair \$(x,y)\$, we compute \$z=1-x-y\$.
The triplet \$(x,y,z)\$ is valid if all the following conditions are met:

\$a\$ and \$n\$ are coprime
there is some \$Q,\:1\le Q \le n\$ such that \$Qz\$ is an integer
we have \$x+y&gt;z\$, \$x+z&gt;y\$ and \$y+z&gt;x\$

Commented
NB: this is the 184-byte version, which is slightly more readable
n =&gt; {                       // n = input
  for(                       // 1st loop:
    o = r = [],              //   o = lookup object, r = output counter
    a = n; x = --a / n;      //   go from a = n - 1 to 1
  )                          //   and define x = a / n
  for(                       // 2nd loop:
    P = n; P; P--            //   go from P = n to 1
  )                          //
  for(                       // 3rd loop:
    p = P; y = --p / P;      //   go from p = P - 1 to 1
  )                          //   and define y = p / P
  for(                       // 4th loop:
    Q = n; Q;                //   go from Q = n to 1
  ) (                        //
      z = Q - x * Q - y * Q, //   define z = Q(1 - x - y)
      g = (a, b) =&gt;          //   g is a helper function which
        b ?                  //     recursively computes the GCD
          g(b, a % b)        //     of 2 given integers
        :                    //
          a &lt; 2              //     and returns true if it equals 1
    )(a, n) &amp;                //   use it to figure out if a and n are coprime
    !(z % 1) &amp;               //   make sure that z is an integer
    !o[                      //   make sure that the key k ...
      k = [x, y, z /= Q--]   //     ... made of [ x, y, z / Q ] ...
          .sort()            //     ... and sorted (lexicographically)
    ] &amp;                      //   was not already found
    x + y &gt; z &amp;              //   make sure that all triangle inequalities
    x + z &gt; y &amp;              //   are fulfilled
    y + z &gt; x ?              //   if all of the above is true:
      o[k] = ++r             //     increment r and save the key in o
    :                        //   else:
      0;                     //     do nothing
  return +r                  // return the final result
}                            //