Let T(n) be the set of integer-sided triangles with perimeter n. For an arithmetic property f and a choice of the smallest, middle or largest side, let S(n) be the number of triangles in T(n) whose chosen side k has f(k)=1. The OEIS contains several such sequences, all defined by double sums with O(n^2) terms: A308453, A308455 and A308454 (the smallest, middle or largest side is squarefree) and A308202 and A308209 (the smallest or largest side is coprime to n). We prove that the number W_n(k) of triangles of perimeter n whose chosen side equals k is, for each of the three choices, an affine function of k on at most two intervals and two residue classes modulo 2, with explicit coefficients. Since the parity of k enters the weights only through the intercepts, S(n) is a combination, with explicit rational coefficients, of differences of three prefix functions at at most four points: the counts over even and odd k, and the first moment sum of k*f(k). For squarefree sides these prefix sums are evaluated by the identity mu^2(k) in O(sqrt(n)) arithmetic operations; for sides coprime to n they are evaluated in O(2^omega(n)) arithmetic operations once n is factored. The Python 3.12 implementation agrees with the OEIS data (70-72 terms each). A308453 is computed for n=10^13 in 1.7 s (the double sum needs 3.4 s already at n=10^4), and A308202 for n=10^24+7 in 0.34 ms.
No takes yet. Share an insight, caveat, or question.
Mark Kim (2026) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: